Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS多部分表单请求失败,尝试从对象[1]插入nil对象_Ios_Objective C_Restkit_Multipartform Data - Fatal编程技术网

iOS多部分表单请求失败,尝试从对象[1]插入nil对象

iOS多部分表单请求失败,尝试从对象[1]插入nil对象,ios,objective-c,restkit,multipartform-data,Ios,Objective C,Restkit,Multipartform Data,尝试使用Restkit执行多部分表单请求时,我得到了一个NSdictionary错误?我不知道为什么会出现这个错误 [\uu NSPlaceholderDictionary initWithObjects:forKeys:count:]:尝试从对象[1]插入nil对象。 NSMutableURLRequest *request = [[RKObjectManager sharedManager] multipartFormRequestWithObject:obj

尝试使用Restkit执行多部分表单请求时,我得到了一个NSdictionary错误?我不知道为什么会出现这个错误

[\uu NSPlaceholderDictionary initWithObjects:forKeys:count:]:尝试从对象[1]插入nil对象。

NSMutableURLRequest *request = [[RKObjectManager sharedManager] multipartFormRequestWithObject:obj
                                                                                        method:RKRequestMethodPOST path:@"v1/things/update_avatar.json"
                                                                                    parameters:@{
                                                                                             @"auth_token" : self.accessToken,
                                                                                             @"email" : user.userID,
                                                                                             @"api_key" : self.api_key,
                                                                                             @"avatar" : @"userAvatar"
                                                                                             }
                                                                     constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {

     [formData appendPartWithFileData:UIImageJPEGRepresentation(image, 1)
                                 name:@"obj[image]"
                             fileName:@"userAvatar.jpeg"
                             mimeType:@"image/jpeg"];
 }];



RKObjectRequestOperation *operation = [[RKObjectManager sharedManager] objectRequestOperationWithRequest:request
                                                                                                 success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
                                                                                                     //
                                                                                                     DLog(@"");
                                                                                                 } failure:^(RKObjectRequestOperation *operation, NSError *error) {
                                                                                                     //
                                                                                                     DLog(@"");
                                                                                                 }];
[[RKObjectManager sharedManager] enqueueObjectRequestOperation:operation]; // NOTE: Must be enqueued rather than started
NSMutableURLRequest*请求=[[RKObjectManager sharedManager]multipartFormRequestWithObject:obj
方法:RKRequestMethodPOST路径:@“v1/things/update_avatar.json”
参数:@{
@“授权令牌”:self.accessToken,
@“电子邮件”:user.userID,
@“api_密钥”:self.api_密钥,
@“化身”:@“用户化身”
}
构造体WithBlock:^(id formData){
[formData appendPartWithFileData:UIImageJPEGRepresentation(图像,1)
名称:@“obj[图像]”
文件名:@“userAvatar.jpeg”
mimeType:@“image/jpeg”];
}];
RKObjectRequestOperation*操作=[[RKObjectManager sharedManager]objectRequestOperationWithRequest:request
成功:^(RKObjectRequestOperation*操作,RKMappingResult*映射结果){
//
DLog(@“);
}失败:^(RKObjectRequestOperation*操作,NSError*错误){
//
DLog(@“);
}];
[[RKObjectManager sharedManager]排队ObjectRequestOperation:operation];//注意:必须排队,而不是启动

它可能是其中一个
self.accessToken
user.userID
self.api\u key
为零


使用
NSParameterAssert
在调试模式下检查这些参数

它可能是
self.accessToken
user.userID
self.api\u键
为零的参数之一

使用
NSParameterAssert
在调试模式下检查这些参数