diff --git a/LeanCloudFeedback/LCUserFeedbackThread.m b/LeanCloudFeedback/LCUserFeedbackThread.m index 04cccdf..bb8f802 100644 --- a/LeanCloudFeedback/LCUserFeedbackThread.m +++ b/LeanCloudFeedback/LCUserFeedbackThread.m @@ -54,7 +54,7 @@ -(NSMutableDictionary *)postData { if (_remarks) { [data setObject:self.remarks forKey:@"remarks"]; } - _iid = [AVInstallation currentInstallation].objectId; + _iid = [AVInstallation defaultInstallation].objectId; if (_iid) { [data setObject:self.iid forKey:@"iid"]; } @@ -188,14 +188,11 @@ - (void)fetchFeedbackRepliesInBackgroundWithBlock:(AVArrayResultBlock)block { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ for (LCUserFeedbackReply *reply in replies) { if (reply.attachment) { - AVFile *attachmentFile = [AVFile fileWithURL:reply.attachment]; - NSError *error; - NSData *data; - data = [attachmentFile getData:&error]; - if (error) { - FLog(@"attachment getData error"); - } else { + NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:reply.attachment]]; + if (data) { reply.attachmentImage = [UIImage imageWithData:data]; + } else { + FLog(@"attachment getData error"); } } } diff --git a/LeanCloudFeedback/LCUserFeedbackViewController.m b/LeanCloudFeedback/LCUserFeedbackViewController.m index 2da849d..d7e7395 100644 --- a/LeanCloudFeedback/LCUserFeedbackViewController.m +++ b/LeanCloudFeedback/LCUserFeedbackViewController.m @@ -308,8 +308,8 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking UIImage *originImage = info[UIImagePickerControllerOriginalImage]; [self prepareFeedbackWithBlock:^(BOOL succeeded, NSError *error) { if ([self filterError:error]) { - AVFile *attachment = [AVFile fileWithName:@"feedback.png" data:UIImageJPEGRepresentation(originImage, 0.6)]; - [attachment saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { + AVFile *attachment = [AVFile fileWithData:UIImageJPEGRepresentation(originImage, 0.6) name:@"feedback.png"]; + [attachment uploadWithCompletionHandler:^(BOOL succeeded, NSError *error) { if ([self filterError:error]) { LCUserFeedbackReply *feedbackReply = [LCUserFeedbackReply feedbackReplyWithAttachment:attachment.url type:LCReplyTypeUser]; feedbackReply.attachmentImage = originImage; diff --git a/Podfile b/Podfile index c0ebf4d..90f54ae 100644 --- a/Podfile +++ b/Podfile @@ -9,11 +9,11 @@ workspace 'LeanCloudFeedback.xcworkspace' target 'LeanCloudFeedback' do project 'LeanCloudFeedback.xcodeproj' - pod 'AVOSCloud' + pod 'AVOSCloud', '10.1.0' end target 'LeanCloudFeedbackDemo' do project 'LeanCloudFeedbackDemo/LeanCloudFeedbackDemo.xcodeproj' - pod 'AVOSCloud' + pod 'AVOSCloud', '10.1.0' pod 'LeanCloudFeedback', :path => '.' end