1
共享時,請選擇不同的項目
首次應用程序安裝和共享圖像不工作,它顯示警告:此項目不能共享。在WhatsApp的
此產品不能共享。請選擇其他項目。
我會嘗試第二次圖像共享成功。什麼是問題?
-(void)TwitterAndmanyMore
{
UIImage * image = _imageView.image;
NSArray * items = @[image];
UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:items applicationActivities:nil];
// and present it
[self presentActivityController:controller];
}
- (void)presentActivityController:(UIActivityViewController *)controller {
// for iPad: make the presentation a Popover
controller.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:controller animated:YES completion:nil];
UIPopoverPresentationController *popController = [controller popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
popController.barButtonItem = self.navigationItem.leftBarButtonItem;
// access the completion handler
controller.completionWithItemsHandler = ^(NSString *activityType,
BOOL completed,
NSArray *returnedItems,
NSError *error)
{
// react to the completion
NSLog(@"----retu------%@",returnedItems);
if (completed)
{
[self showContine];
//[self viewWillAppear:YES];
// user shared an item
NSLog(@"We used activity type%@", activityType);
} else {
// user cancelled
NSLog(@"We didn't want to share anything after all.");
}
if (error) {
NSLog(@"An Error occured: %@, %@", error.localizedDescription, error.localizedFailureReason);
}
};
}
這個問題只發生在iOS的11或舊版本嗎? –
直到我檢查ios 11先生 –
檢查它在ios 10或ios 9中,因爲我也只在ios 11中遇到與UIActivityViewController有關的問題。如果你確認問題只在ios 11上,那麼編輯你的問題,因爲它只發生在ios 11中。 –