gpt4 book ai didi

ios - 从UIActivityViewController调用时,选择收件人后WhatsApp卡住

转载 作者:行者123 更新时间:2023-12-01 20:17:00 25 4
gpt4 key购买 nike

我正在使用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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com