UIActivityController behaviour different on device and simulator

前端 未结 2 418
长情又很酷
长情又很酷 2021-01-15 18:40

I add an activityViewController to my app like below, passing in an image

UIActivityViewController *avc = [[UIActivityViewController alloc]initWithActivityIt         


        
2条回答
  •  一向
    一向 (楼主)
    2021-01-15 19:13

    Okay I have figured the problem.

    The options shown in the UIActivityViewController totally depends on the type of items that are to be shared. For example, if there is a video, it will not show Facebook or twitter option. But if it's an image and title, it definitely will show the relevant options.

    The following will show up apps like mail, twitter, Facebook, assignToContact, save to camera roll, print, copy, etc

    // Create the content
    NSString *message = @"The Upcoming App Scribble Talk";
    UIImage *imageToShare = [UIImage imageNamed:@"createbtn.png"];
    
    NSArray *objectsToShare = [NSArray arrayWithObjects:message, image, nil];
    

    However, the following shall bring up only camera roll, mail or copy.

    NSString *message = @"The Upcoming App Scribble Talk";
    NSString *videoToShare = @"myFirsScribble.mov";
    NSURL *videoPath = [NSURL fileURLWithPath:videoToShare];
    
    NSArray *objectsToShare = [NSArray arrayWithObjects:message, videoPath, nil];
    

提交回复
热议问题