6

Let's say that I store some ID data in App1 and want to access it in App2 on the same device. Is this possible on the platform? Are there any workarounds for this if not?

locoboy
  • 38,002
  • 70
  • 184
  • 260

3 Answers3

3

You can use the iOS keychain. Here's a good tutorial on keychain access groups.

John Estropia
  • 17,460
  • 4
  • 46
  • 50
2

One workaround is to register apps as handling some filetype. When such file is about to be opened, a user gets the choice of apps that can handle it and the chosen app gets a copy of the file copied to it's ~Documents/Inbox directory. But i think you're better with some external service.

Peter Sarnowski
  • 11,900
  • 5
  • 36
  • 33
2

Image Share Between My app to Instagram:

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.ig"];

    NSData *imageData = UIImagePNGRepresentation(originalImageView.image);
    [imageData writeToFile:savedImagePath atomically:YES];        
    NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath];

    UIDocumentInteractionController * docController = [[UIDocumentInteractionController alloc] init];
    docController.delegate = self;
    [docController retain];
    docController.UTI = @"com.instagram.photo";
    [docController setURL:imageUrl];
    [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
} 
Krypton
  • 3,337
  • 5
  • 32
  • 52
Amit
  • 1,795
  • 1
  • 17
  • 20