1

尝试使用 Restkit 进行多部分表单请求,但出现 NSdictionary 错误?我不确定为什么会收到此错误。

[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: 尝试从 objects[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
4

1 回答 1

1

它可能是其中之一self.accessTokenuser.userID并且self.api_key为零。

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

于 2015-04-17T09:15:34.593 回答