Sharing data between iOS apps

Source: Internet
Author: User

Preparatory work

Two new applications, ProjectA and PROJECTB, respectively.
Then from a contribute data to B

Then set the URL of the PROJECTB schemes

To add a jump URL in projecta:

nsurl *url = [nsurl urlwithstring:@"Projectb:hehe"]; [[uiapplication sharedapplication]  Openurl:url];   
 
   
  

So the argument behind the Projectb:hehe colon is the data we can pass through.

App Status
    • b does not start, then B is started. and call the following method.
-(BOOL) Application: (uiapplication *) application didfinishlaunchingwithoptions: (  NsdictionaryNSLog(@"Projectb_start"//Override point for customization after application Launch. return YES;}   
 
   
  
    • At this point B has started, but run in the background, this time will not invoke the method, and will go:
//When an application is opened by another program, this method is called, in which the data transfer between two applications can be implemented -(BOOL) Application: (uiapplication * ) Application OpenURL: (nsurl *) URL sourceapplication: (nsstring *) sourceapplication annotation: ( ID NSLog (@ "%@"NSLog(@"%@"returnYES;}   
 
   
  

is not very simple, then you also hurry to try it!

Sharing data between iOS apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.