domain:錯誤域 code:錯誤編碼 userInfo:錯誤緣由 NSString *domain = @"xxxxxx"; NSString *desc = NSLocalizedString(@"xxx", @"xxx");//NSLocalizedString國際化 NSDictionary *userInfo = @{NSLocalizedDescriptionKey : desc }; NSError *error = [NSError errorWithDomain:domain code:-101 userInfo:userInfo];