(turn) How to use OpenURL

Source: Internet
Author: User

View Plaincopy to Clipboardprint?
    1. [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:appstring]];

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

Among the system's appstring are:

View Plaincopy to Clipboardprint?
    1. Map Http://maps.google.com/maps?q=Shanghai
    2. Email Mailto://[email protected]
    3. Tel tel://10086
    4. MSG sms://10086

Map Http://maps.google.com/maps?q=Shanghai

Email Mailto://[email protected]

Tel tel://10086

MSG sms://10086

In addition to this, you can also define your own URL by:

View Plaincopy to Clipboardprint?
    1. Open info.plist, add a URL types
    2. Expand URL Types, expand Item1, and change the URL identifier under ITEM1 to URL Scheme
    3. Expand URL Scheme To modify the contents of Item1 to MyApp
    4. Other programs can access this custom URL through myapp://

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

Resources:

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 even other applications. This is a piece of code that I often need to use in iphone development, and it's just a single line.

View Plaincopy to Clipboardprint?
    1. -(ibaction) Openmaps {
    2. Open 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 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 a email to Apple support
    4. [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];
    5. }

-(ibaction) Openemail {
Open mail/Fire off a email to Apple support
[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];
}

View Plaincopy to Clipboardprint?
    1. -(ibaction) Openphone {
    2. Dial number
    3. Call Google 411
    4. [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "tel://8004664411"];
    5. }

-(ibaction) Openphone {

Dial number
Call Google 411
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "tel://8004664411"];
}

View Plaincopy to Clipboardprint?
    1. -(ibaction) opensms {
    2. Open sms
    3. Text to Google SMS
    4. [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "sms://466453"];
    5. }

-(ibaction) opensms {
Open sms
Text to Google SMS
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "sms://466453"];
}

View Plaincopy to Clipboardprint?
    1. -(ibaction) Openbrowser {
    2. Open your browser
    3. Lanuch any IPhone developers fav site
    4. [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://itunesconnect.apple.com"];
    5. }

-(ibaction) Openbrowser {
Open your browser
Lanuch any IPhone developers fav site
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://itunesconnect.apple.com"];
}

Transferred from: http://blog.sina.com.cn/s/blog_6c515d5a01010e5p.html

(go) How to use OpenURL

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.