iOS UIActivity controller

131 views Asked by At

I am just a newbie in iOS environment. I try to add UIActivity to my project. When I am testing it, it is working fine for iOS 7 but it not working in iOS 8. In iOS 8, it just appear the gray screen but no content at all.

- (void)goToInvite{


    UIImage * image = [UIImage imageNamed:@"share_img.jpg"];

    NSString *textObject = @"Share your thoughts and ideas about design on D:ta!k.";

    NSString *urlString = [NSString stringWithFormat:@"https://itunes.apple.com/us/app/messenger/id454638411"];

    NSURL *url = [NSURL URLWithString:urlString];

    NSArray *activityItems = [NSArray arrayWithObjects:textObject, url,image,  nil];

    //-- initialising the activity view controller
    UIActivityViewController *avc = [[UIActivityViewController alloc]
                                     initWithActivityItems:activityItems
                                     applicationActivities:nil];

    [avc setValue:@"Dta!k" forKey:@"subject"];

   avc.excludedActivityTypes = @[UIActivityTypePrint,UIActivityTypeAirDrop, UIActivityTypeAssignToContact ];


    //-- define the activity view completion handler
    avc.completionHandler = ^(NSString *activityType, BOOL completed){
        if (completed) {
            // NSLog(@"Selected activity was performed.");
        } else {
            if (activityType == NULL) {
                //   NSLog(@"User dismissed the view controller without making a selection.");
            } else {
                //  NSLog(@"Activity was not performed.");
            }
        }
    };

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

}
0

There are 0 answers