You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/11/27 20:18:32 UTC

[GitHub] maverickmishra closed pull request #109: CB-10935: fix an issue of can not sync new contact into icloud which update new photo with ABPersonSetImageData()

maverickmishra closed pull request #109: CB-10935: fix an issue of can not sync new contact into icloud which update new photo with ABPersonSetImageData()
URL: https://github.com/apache/cordova-plugin-contacts/pull/109
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVContact.m b/src/ios/CDVContact.m
index a1dd85d..eaef570 100644
--- a/src/ios/CDVContact.m
+++ b/src/ios/CDVContact.m
@@ -356,7 +356,11 @@ - (bool)setFromContactDict:(NSDictionary*)aContact asUpdate:(BOOL)bUpdate
                             data = [NSData dataWithContentsOfURL:photoUrl options:NSDataReadingUncached error:&err];
                         }
                         if (data && ([data length] > 0)) {
-                            bSuccess = ABPersonSetImageData(person, (__bridge CFDataRef)data, &error);
+                            // bSuccess = ABPersonSetImageData(person, (__bridge CFDataRef)data, &error);
+                            // Direct base64 data into the ABPersonSetImageData can lead to failure of synchronizing the contacts into icloud.
+                            // converted to JPEG format can fix this problem
+                            NSData *imageData = UIImageJPEGRepresentation([UIImage imageWithData:data],1);
+                            bSuccess = ABPersonSetImageData(person, (__bridge CFDataRef)imageData, &error);
                         }
                         if (!data || !bSuccess) {
                             NSLog(@"error setting contact image: %@", (err != nil ? [err localizedDescription] : @""));


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org