为什么我的消息在viber中共享两次,我使用了UIActivityViewController

时间:2015-07-10 10:15:00

标签: ios objective-c share uiactivityviewcontroller viber

我已经使用UIActivityViewController在Facebook,Twitter,Viber等上分享我的消息....似乎消息在Viber中发送两次,但其他人都可以。你能帮我吗?我使用了下面给出的代码......

-(void)shareContent {
    NSString * message;
    NSArray * itemsArray = [NSArray new] ;
    if ([shareFlag isEqualToString:@"Friend"]) {
        message = @"Hi, I am using Amar Sticker, an amazing app to download & share cool Bangla Stickers. Click here and get it for FREE: http://goo.gl/qK7HRw";
        NSURL *appLink = [NSURL URLWithString:@"http://goo.gl/qK7HRw"];
        itemsArray = @[message, appLink];
        shareFlag = @"";
    }

    UIActivityViewController * avc = [[UIActivityViewController alloc] initWithActivityItems:itemsArray applicationActivities:nil];

    [avc setExcludedActivityTypes:@[UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard,UIActivityTypeSaveToCameraRoll]];

    [avc setCompletionHandler:^(NSString *activityType, BOOL completed) {

    }];
    [self presentViewController:avc animated:YES completion:nil];

}

1 个答案:

答案 0 :(得分:0)

经过多次搜索并以多种方式进行后,我发现它只发生在我共享一个数组时,它无法正确处理数组的共享对象,也许它是一个viber的bug。当我只发布一个字符串或网址时,它可以正常发送。我已经测试过使用2,3,4项arrry和只有一个字符串/ url等。