This is good last week, but today when I use the UIActivtyViewController, the uiactivityviewcontroller crashes.
- (void)shareThePrice { UIImage *screenShotImg = [self screenShot]; NSString *string = NSLocalizedString(@"shareString", nil); UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[string,screenShotImg] applicationActivities:nil]; [activityViewController setCompletionWithItemsHandler: ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *error) { if ( completed ) {
when the presentViewController: method is used, it fails. I do not know what happened?
Communications error: <OS_xpc_error: <error: 0x107f39b10> { count = 1, contents = "XPCErrorDescription" => <string: 0x107f39f18> { length = 22, contents = "Connection interrupted" } }> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray removeObjectsAtIndexes:]: index set cannot be nil' *** First throw call stack: ( 0 CoreFoundation 0x0000000105209f35 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010476cbb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000105142278 -[NSMutableArray removeObjectsAtIndexes:] + 536 3 UIKit 0x0000000106b23dd8 _UIApplicationExtensionDiscoveryGetPostprocessedExtensions + 188 4 UIKit 0x0000000106b23a33 -[_UIActivityApplicationExtensionDiscovery activitiesMatchingInputItems:sourceIsManaged:error:updateBlock:] + 1032 5 UIKit 0x0000000106a13cea -[UIActivityViewController _availableActivitiesForItems:applicationExtensionActivities:] + 464 6 UIKit 0x0000000106a14cc4 -[UIActivityViewController viewDidLoad] + 157
source share