0

I want to share my map location to other apps using location, how can i do that for ios.

I want to do something like this when i click share button.

enter image description here

Then pass my longitute and latitude when opening the selected app, and it will show me my current location to the location I specified.

lhencq
  • 505
  • 2
  • 6
  • 16

1 Answers1

0

Try to use UIActivityViewController like

UIActivityViewController *activityViewController = 
[[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; 
NSArray *excludedActivities = @[UIActivityTypePostToFacebook, 
                                UIActivityTypePostToTwitter,
                                UIActivityTypePostToWeibo, 
                                UIActivityTypeMessage, 
                                UIActivityTypeMail, 
                                UIActivityTypePrint,
                                UIActivityTypeCopyToPasteboard, 
                                UIActivityTypeAssignToContact, 
                                UIActivityTypeSaveToCameraRoll, 
                                UIActivityTypeAddToReadingList,
                                UIActivityTypePostToFlickr, 
                                UIActivityTypePostToVimeo, 
                                UIActivityTypePostToTencentWeibo]; 
activityViewController.excludedActivityTypes = excludedActivities; 
[self presentViewController:activityViewController animated:YES completion:nil];

Items is what you want to share, and excludedActivityTypes is the sharing types.

Ax1le
  • 6,563
  • 2
  • 14
  • 61