我正在使用UIActivityViewController
共享我的iOS应用。
从选项列表中选择WhatsApp时,它将带我到正确的屏幕。我可以四处走动,所有按钮都可以使用。
但是,一旦我选择了收件人,WhatsApp就会冻结。
有人知道这是怎么回事吗?有人遇到过此错误吗?
编辑(已添加代码)
这是我用来调用UIActivityViewController
的代码:
- (void) sharePressed:(UIBarButtonItem *)sender {
NSString* shareText = @"Hello World!";
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[shareText] applicationActivities:nil];
[self presentViewController:controller animated:YES completion:nil];
NSLog(@"This method ran: sharePressed");
}
它是最基本的。它适用于除WhatsApp之外的所有内容。
最佳答案
试试这个代码
- (IBAction)shareButton:(UIBarButtonItem *)sender
{
NSString *textToShare = @"Look at this awesome website for aspiring iOS Developers!";
NSURL *myWebsite = [NSURL URLWithString:@"http://www.codingexplorer.com/"];
NSArray *objectsToShare = @[textToShare, myWebsite];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
NSArray *excludeActivities = @[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo];
activityVC.excludedActivityTypes = excludeActivities;
[self presentViewController:activityVC animated:YES completion:nil];
}
关于ios - 从UIActivityViewController调用时,选择收件人后WhatsApp卡住,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36586973/