简体   繁体   中英

Unable to set contact image in iOS8 using social framework

In my application i need to set an image as a contact image for a specific contact. For that i have implemented UIActivityViewController and it works fine in iOS7 devices. But in iOS8 device while selecting a contact for assigning an image, it is not displaying any options. Am i miss anything special for iOS8 devices ?

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[self, imageUrl] applicationActivities:nil];
//imageUrl - is the NSURL instance for image.
activityVC.excludedActivityTypes = @[UIActivityTypeAirDrop, UIActivityTypeCopyToPasteboard, UIActivityTypePrint];
activityVC.completionHandler = ^(NSString *activityType, BOOL completed) {
     //Added completion handler    
};
[self presentViewController:activityVC animated:YES completion:nil];

And it displays ActivityViewController as below and on selecting it displays contact list. But the option is not available.

在此处输入图片说明

The only thing standing out to me is the activity items you're passing into the controller. Try instantiating it like so:

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[image] applicationActivities:nil];

This is assuming image is a UIImage .

Reference: UIActivityViewController Class Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM