“This item cannot be shared. Please select a different item.” WhatsApp iOS share extension failure message

This bug is fixed by WhatsApp team on 23rd May, 2016 (build no. 2.16.4).

Unable to share NSString object using UIActivityViewController to WhatsApp.

  • ABID in Whatsapp URL schemes
  • Open WhatsApp conversation using Abid doesn't work
  • How send image to WhatsApp from my application?
  • Whatsapp link on products?
  • Sending an URL alongside text using WhatsApp URL scheme
  • Share link using whatsapp
  • I tried to share using below code. But once contact is selected from the list, it shows an alert displaying “This item cannot be shared. Please select a different item.

    CODE

    NSString *shareText = @"Temp text to share";
    NSArray *itemsToShare = @[shareText];
    
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
    

    I am facing this problem after updating WhatsApp to version 2.16.2

    5 Solutions Collect From Internet About ““This item cannot be shared. Please select a different item.” WhatsApp iOS share extension failure message”

    Received a response from WhatsApp team

    – WhatsApp Support –

    Hi,

    Sorry for the delay! We have received many emails recently, and we do
    our best to answer them all. Thank you for your patience.

    Thank you for informing us about the issue; it will be fixed in a
    future version of WhatsApp. Unfortunately, we cannot comment on any
    future timelines, sorry. Thank you for your continued patience and
    support of WhatsApp.

    Cheers, Hans

    So, they acknowledge the bug and will fix this in the next release.

    Possible Workarounds =>

    • Till then one can use UrlSchemes to share plaintext+url. Follow
      Spydy’s answer.

      OR
    • One can create subclass of UIActivity with
      activityCategory as UIActivityCategoryShare with whatsapp icon. Then
      when user selects it, will use urlschemes to share text. For this use JBWhatsAppActivity

      OR
    • Just share NSUrl object for sharing url. Once the fix is done you can revert to sharing plain text and url.

    have faced same issue after updating whatsapp. Even you press “cancel” on whatsapp still completion block shows success.
    i have resolved it by using “WFActivitySpecificItemProvider” and “WFActivitySpecificItemProvider“when sharing on whatsapp then dissmiss activityViewController and share via ur. You can pull WFActivitySpecificItemProvider, activityViewController classes from https://github.com/wileywimberly/WFActivitySpecificItemProvider

    here is my code

    - (void)share{
    
    NSString *defaultMessage = @"your message may contain url";
    
    // Use a dictionary
    WFActivitySpecificItemProvider *provider1 =
    [[WFActivitySpecificItemProvider alloc]
     initWithPlaceholderItem:@""
     items:@{
             WFActivitySpecificItemProviderTypeDefault : defaultMessage,
             UIActivityTypePostToFacebook : defaultMessage,
             UIActivityTypeMail : defaultMessage,
             UIActivityTypeMessage : defaultMessage,
             @"com.linkedin.LinkedIn.ShareExtension":defaultMessage,
             UIActivityTypePostToTwitter : defaultMessage
    
             }];
    
    
    // Use a block
    WFActivitySpecificItemProvider *provider2 =
    [[WFActivitySpecificItemProvider alloc]
     initWithPlaceholderItem:@""
     block:^(NSString *activityType){
    
         if ([activityType isEqualToString:@"net.whatsapp.WhatsApp.ShareExtension"]) {
    
    
             [avc dismissViewControllerAnimated:NO completion:nil];
    
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    
    
    
                 NSString *string = [NSString stringWithFormat:@"whatsapp://send?text=%@",defaultMessage];
                 NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
                 [[UIApplication sharedApplication] openURL: url];
    
    
             });
         }
    
         return defaultMessage;
     }];
    
    
    avc = [[UIActivityViewController alloc]
           initWithActivityItems:@[provider1, provider2]
           applicationActivities:nil];
    
    [avc dismissViewControllerAnimated:YES completion:nil];
    [avc setValue:sharingHeader forKey:@"subject"];
    
    [avc setCompletionHandler:^(NSString *activityType, BOOL completed) {
    
        if (activityType) {
    
    
            NSLog(@"activity: %@ completed: %@",activityType,completed ? @"YES" : @"NO");
    
    
        } else {
    
    
            NSLog(@"No activity was selected. (Cancel)");
        }
    
    }];
    
    [self presentViewController:avc animated:YES completion:nil];
    }
    

    WhatsApp has fixed this bug in the their update dated 23rd May, 2016 (build no. 2.16.4).

    It hasn’t been reported by official sources, but I have tested it in my code – works fine.

    With the latest version of whatsapp, Now we can not share both text and URL at the same time.

    I tried the below code

    NSArray *activityItems= @[someText,[NSURL URLWithString:@"http://www.google.com"]];
    

    With this code i am able to share only the URL link, the whatsApp filtered out the “someText” text.

    but the other share apps(SMS etc) able to share both text and url.

    hope WhatsApp fixes this issue soon.

    I’m not sure about your question… Do you want just send text by whatsapp? If yes, you don’t need use UIActivityViewController. Just use urlschemes.

    Something like that:

    NSString *string = @"whatsapp://send?text=<YOUR MESSAGE>";
    NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    [[UIApplication sharedApplication] openURL: ];
    

    You also can check if the user have whatsapp installed

    if ([[UIApplication sharedApplication] canOpenURL: url]) {
       // wahtsapp installed
    } else {
       // whatsapp not installed
    }
    

    Look this question:
    Share image/text through WhatsApp in an iOS app