Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #66 from zapcannon87/master
Browse files Browse the repository at this point in the history
Tweak code
  • Loading branch information
zapcannon87 committed Apr 4, 2018
2 parents 010e8ca + e194c68 commit 0847a00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
13 changes: 5 additions & 8 deletions LeanCloudFeedback/LCUserFeedbackThread.m
Expand Up @@ -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"];
}
Expand Down Expand Up @@ -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");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions LeanCloudFeedback/LCUserFeedbackViewController.m
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Expand Up @@ -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

0 comments on commit 0847a00

Please sign in to comment.