Ways to open other programs in iOS programs

Source: Internet
Author: User

1.1 If the program you are opening is not your own, you will find the URL of the app being opened schemes.
http://jbguide.me/2012/09/12/how-to-find-url-schemes%EF%BC%9F/

1.2 If the open program is written by itself, then write the program to implement
1) Increase in appname-info.plist

<key>CFBundleURLTypes</key>    <array>        <dict>            <key>cfbundleurlschemes </key>            <array>                <string>CalledApp</string>            </array>            <key> cfbundleurlname</key>            <string>com.yourcompany.appName</string>        </dict>    </array>

2) If required parameters to achieve uiapplication delegate

    • (BOOL) Application: (uiapplication ) application OpenURL: (nsurl ) URL
      Sourceapplication: (NSString *) sourceapplication annotation: (id) Annotation {
      if ([[URL scheme] isequaltostring:@ "Calledapp"]) {
      Parse parameters according to path .... return YES;
      }
      return NO;
      }

2 Open another program app to do the following:

if (YES = = [[uiapplication sharedapplication] canopenurl:[nsurl urlwithstring:@ "Calledapp://com.yourcompany.appname" ]]){

[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "Calledapp://com.yourcompany.appname"]]// Other parameters are fed through the path

}

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.