Niharika Niharika - 1 month ago 7
iOS Question

Convert URL into hyperlink

I am working on a app in which I am sharing event image with some url
When sharing the event image I am using this content :=

"Hey! I just saw "Venue Name" is having "Event Name" through the XXXX App! We
should check it out. https://app.com/site/redirectlink?event_id=%@"

Now can I make this "https://app.com/site/redirectlink?event_id=%@" link to hyperlink "here"?

I am sharing this content via "UIActivityViewController".
Actually this URL (https://app.com/site/redirectlink?event_id=%@) is used for deep linkling later on when user click this it will be redirect to particular event depend on the event_id.
Instead on the whole URL I want to use here(as hyperlink) only.

Answer Source

might be help you this way..

NSString *url=@"https://app.com/site/redirectlink?event_id=%@";
    NSString * title =[NSString stringWithFormat:@"Hey! I just saw \"Venue Name\" is having \"Event Name\" through the XXXX App! We should check it out <html> <body> <a href = '%@'>here</a> </body> </html>",url];
    NSArray* dataToShare = @[title];
    UIActivityViewController* activityViewController =[[UIActivityViewController alloc] initWithActivityItems:dataToShare applicationActivities:nil];
    activityViewController.excludedActivityTypes = @[UIActivityTypeAirDrop];
    [self presentViewController:activityViewController animated:YES completion:^{}];