Assuming there are two apps, the project name is Samplea and Sampleb, you need to click a button in Samplea to start the Sampleb and pass a string. The specific implementation steps are as follows:
1. Add a URL schemes to the Info.plist file in Sampleb and specify a string that is the name of the link that invokes the app:
2. Execute the following code in the Samplea button click Operation:
-(Ibaction) Openclickhandler: (ID) sender{ [[uiapplication sharedapplication] Openurl:[nsurl URLWithString:@ "myapp23://time_is_money"];}
3. In the Appdelegate class of Sampleb, invoke the URL that the system event handler passes over:
-(BOOL) Application: (UIApplication *) application Handleopenurl: (Nsurl *) url{ *strinfo = [[url host] Stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding]; *alertview = [[Uialertview alloc] Initwithtitle:@ " hint "delegate: Nil Cancelbuttontitle:@ "OK" Otherbuttontitles:nil]; [Alertview show]; return YES;}
Summarize:
1. When launching other apps by OpenURL, the address format is @ "URL scheme://url identifier", where URL identifier is optional.
2. URL identifier cannot contain spaces and question marks.
3. Apple does not support this practice and is used with caution in actual product development.