Ios UIActivityViewController完成处理程序显示';已完成';即使用户不是';无法登录Tumblr或其他应用程序
我使用completionWithItemsHandler来确定selectedItems是否已发布到Tumblr。我想展示一个“成功!”如果post已完成,但即使用户无法登录Tumblr,completionHandler也会返回“completed”(已完成),则发出警报。也就是说,用户完成了选择项目、打开活动视图和选择Tumblr-->的步骤。这将打开Tumblr应用程序并要求登录。如果用户按“取消”并返回到我的应用程序,completionHandler会说活动已“完成”。有没有办法确定post是否成功?有没有办法测试用户是否能够登录到应用程序?当可能存在这些类型的问题时,有没有处理“成功”警报的建议?Ios UIActivityViewController完成处理程序显示';已完成';即使用户不是';无法登录Tumblr或其他应用程序,ios,tumblr,sharing,uiactivityviewcontroller,Ios,Tumblr,Sharing,Uiactivityviewcontroller,我使用completionWithItemsHandler来确定selectedItems是否已发布到Tumblr。我想展示一个“成功!”如果post已完成,但即使用户无法登录Tumblr,completionHandler也会返回“completed”(已完成),则发出警报。也就是说,用户完成了选择项目、打开活动视图和选择Tumblr-->的步骤。这将打开Tumblr应用程序并要求登录。如果用户按“取消”并返回到我的应用程序,completionHandler会说活动已“完成”。有没有办法确定
这是完成处理程序
activityController.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *error){
if (error)
{
//NSError *error;
alertController = [UIAlertController alertControllerWithTitle:@"Error" message:@"Error sharing items" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *errorAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
NSLog(@"Error sharing items: %@", error);
}];
[alertController addAction:errorAction];
[self presentViewController:alertController animated:YES completion:nil];
}
else if (completed)
{
[self.activityIndicator stopAnimating];
if ([self.giftID isEqualToString:@"general"]||[self.giftEntity.giftThanked isEqualToString:@"YES"])
{
alertController = [UIAlertController alertControllerWithTitle:alertTitle message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
// NSLog(@"OK action");
[self dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
if (![self.giftID isEqualToString:@"general"]&&[self.giftEntity.giftThanked isEqualToString:@"NO"])
{
alertController = [UIAlertController alertControllerWithTitle:alertTitle message:@"Mark gift as 'Thanked'?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *yesAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"YES", @"yes action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
self.giftEntity.giftThanked = @"YES";
[self.giftBusObj saveEntities];
[self dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction *noAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"NO", @"no action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
self.giftEntity.giftThanked = @"NO";
[self.giftBusObj saveEntities];
[self dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:noAction];
[alertController addAction:yesAction];
[self presentViewController:alertController animated:YES completion:nil];
}
//Deselect all items in stvc
self.textShare = 0;
self.cardButton.selected = NO;
self.textImageBackground.backgroundColor = [UIColor clearColor];
self.cardImageBackground.backgroundColor = [UIColor clearColor];
[spcvc selectPhotosNone];
[self viewDidLoad];
}
else
{
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"activity controller - not 'completed' nor 'error'" );
}
};
你能发布完成处理程序的代码吗?我刚刚添加了它-谢谢