-1

I am using a table view and i am using it to display clips which i am fetching from core data. Now i have an API for clip path which will connect it to the server clips i want to pass clip id with that API and pass the clip name fetched from the core data.i have tried following thing to make it work but gives me error.I think i am doing it wrong. How would i do that.

       //here is my code but it is giving me error. Can't pass it this way.

   NSArray * activityItems = @[[NSURL URLWithString:@"http://example.com/view-videos.html?task=clip.details&id=%@",_fetchid]];  // this is giving me error and here i also want to send selected clip name with this API


UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:videoToShare applicationActivities:nil];

activityVC.excludedActivityTypes = @[UIActivityTypePostToFacebook,UIActivityTypePostToTwitter,UIActivityTypePostToWeibo,UIActivityTypeCopyToPasteboard,UIActivityTypeMessage];

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


   }
vicky
  • 253
  • 2
  • 14

1 Answers1

1

Try something like this. You are passing some other object not activityItems.

NSString *urlString = [NSString stringWithFormat:@"http://example.com/view-videos.html?task=clip.details&id=%@",fetchid];
NSArray * activityItems = @[[NSURL URLWithString:urlString]];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePostToFacebook,UIActivityTypePostToTwitter,UIActivityTypePostToWeibo,UIActivityTypeCopyToPasteboard,UIActivityTypeMessage];
[self presentViewController:activityVC animated:YES completion:nil];

If you want to share some video then also add that video in activityItems array object

Hope this will help you.

Nirav D
  • 71,513
  • 12
  • 161
  • 183
  • but i need to send id with that URL at the end @Navin – vicky Jun 13 '16 at 07:06
  • I have edited my answer change your code like that, it will work now. – Nirav D Jun 13 '16 at 07:14
  • Have you check my answer. – Nirav D Jun 13 '16 at 09:32
  • ya code wise it is working yet i haven't checked on phone...i have only simulator now will have to check using phone... i will check it and get back...thanks for the answer @Nirav Doctorwala – vicky Jun 13 '16 at 10:40
  • i will have to check it nirav if it won't work i'll get back and don't worry about accepting the answer if it works then i'll definitely accept that :) and i had another problem too if you will answer it will be great , have a look http://stackoverflow.com/questions/37606951/show-a-button-on-getting-json-response-equal-to-a-string-like-unapproved @Nirav Doctoral – vicky Jun 13 '16 at 10:49