IOS Openurl runs other applications

Source: Internet
Author: User

Openurl usage:

View plaincopy
To clipboardprint?

  1. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: appstring];

[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: appstring];

The system appstring includes:

View plaincopy
To clipboardprint?

  1. Map http://maps.google.com/maps? Q = Shanghai
  2. Email mailto: // myname@google.com
  3. Tel: // 10086
  4. Msg sms: // 10086

Map http://maps.google.com/maps? Q = Shanghai

Email mailto: // myname@google.com

Tel: // 10086

Msg sms: // 10086

In addition, you can customize the URL as follows:

View plaincopy
To clipboardprint?

  1. Open info. plist and add a URL types
  2. Expand URL types, expand Item1, and change the URL identifier in Item1 to URL scheme.
  3. Expand the URL scheme and change the content of Item1 to MyApp.
  4. Other programs can access this custom URL through MyApp: //

Open info. plist, add a URL types extension URL types, expand Item1, and change the URL identifier under Item1 to URL scheme extension URL scheme, modify the content of Item1 to MyApp. Other programs can access this custom URL through MyApp: //

References:

P. P1 {margin: 0.0px 0.0px 0.0px 0.0px; Font: 14.0px Menlo}

Http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html

Openurl can help you run maps, SMS, browser, phone, and other applications. This is a piece of code that I often need during iPhone development. It only has one line.

View plaincopy
To clipboardprint?

  1. -(Ibaction) openmaps {
  2. // Open the map
  3. Nsstring * addresstext = @" Beijing "; // @" 1 infinite loop, Cupertino, CA 95014 ";
  4. Addresstext = [addresstext stringbyaddingpercentescapesusingencoding: nsasciistringencoding];
  5. Nsstring * urltext = [nsstring stringwithformat: @ "http://maps.google.com/maps? Q = % @ ", addresstext];
  6. Nslog (@ "urltext ========================%@", urltext );
  7. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: urltext];
  8. }

-(Ibaction) openmaps {
// Open the map
Nsstring * addresstext = @ "Beijing ";
// @ "1 infinite loop, Cupertino, CA 95014 ";
Addresstext = [addresstext stringbyaddingpercentescapesusingencoding: nsasciistringencoding];
Nsstring * urltext = [nsstring stringwithformat: @ "http://maps.google.com/maps? Q = % @ ", addresstext];
Nslog (@ "urltext ========================%@", urltext );
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: urltext];
}

View plaincopy
To clipboardprint?

  1. -(Ibaction) openemail {
  2. // Open mail
  3. // Fire off an email to Apple support
  4. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "mailto: // devprograms@apple.com"];
  5. }

-(Ibaction) openemail {
// Open mail // fire off an email to Apple support
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "mailto: // devprograms@apple.com"];
} View
Plaincopy to clipboardprint?

  1. -(Ibaction) openphone {
  2. // Call
  3. // Call the Google 411
  4. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "Tel: // 8004664411"];
  5. }

-(Ibaction) openphone {

// Call
// Call the Google 411
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "Tel: // 8004664411"];
} View
Plaincopy to clipboardprint?

  1. -(Ibaction) opensms {
  2. // Open the text message
  3. // Text to Google SMS
  4. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "SMS: // 466453"];
  5. }

-(Ibaction) opensms {
// Open the text message
// Text to Google SMS
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "SMS: // 466453"];
}
View plaincopy
To clipboardprint?

  1. -(Ibaction) openbrowser {
  2. // Open the browser
  3. // Lanuch any iPhone developers fav site
  4. [[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "http://itunesconnect.apple.com"];
  5. }

-(Ibaction) openbrowser {
// Open the browser
// Lanuch any iPhone developers fav site
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "http://itunesconnect.apple.com"];
}

Related Article

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.