Use Openurl: [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: appstring];
The system appstring includes:
1. Map http://maps.google.com/maps? Q = Shanghai
2. email mailto: // myname@google.com
3. Tel: // 10086
4. msg sms: // 10086
Openurl can help you run maps, SMS, browser, phone, and other applications.Program. This is a frequently used section in iPhone development.CodeIt only has one row.
// Open the map
-(Ibaction) openmaps {
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];
}
// Open mail
-(Ibaction) openemail {
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "mailto: // devprograms@apple.com"];
}
// Call
-(Ibaction) openphone {
[[Uiapplication sharedapplication] Openurl: [nsurlurlwithstring: @ "Tel: // 8004664411"];
}
// Open the text message
-(Ibaction) opensms {
[[Uiapplication sharedapplication] Openurl: [nsurlurlwithstring: @ "SMS: // 466453"];
}
// Open the browser
-(Ibaction) openbrowser {
[[Uiapplication sharedapplication] Openurl: [nsurlurlwithstring: @ "http://itunesconnect.apple.com"];
}