上传数据时出现错误访问错误

时间:2016-02-18 22:31:19

标签: ios afnetworking

我试图让我的应用程序使用AFNetworking,并在NSDictinary所在的行上出现错误线程1:EXC_BAD_ACCESS(代码= 1,地址= 0x170730058)。

我不知道我哪里出错...

NSData *imageData = UIImageJPEGRepresentation(theimage.image, 1.0);

NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys: thetext.text, @"text",time, @"time", eventId.text, @"eventId",youtubelink, @"youtubelink", (spoiler.isOn?"Y":"N"), @"spoiler", nil];

NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://....../upload.php" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
    [formData appendPartWithFileData:imageData name:@"image" fileName:@"image.jpg" mimeType:@"image/jpeg"];
} error:nil];

1 个答案:

答案 0 :(得分:0)

@需要在代码末尾的Y和N处添加