iphone - Open map within application for iOS6 or previous -


i have lat , long of address , want open maps both iphone map in ios6 , google map before ios6 within application. tried open map of google before ios6 not working. [[uiapplication sharedapplication] canopenurl: [nsurl urlwithstring:@"comgooglemaps://?center=46.414382,10.013988&mapmode=streetview"]];

i doing above line of code mentioned not working. kindly if 1 know please me on that. in advance.

there 2 different methods: canopenurl , openurl

with canopenurl check it possible open external application (in case map app -from apple of google-.

once have checked it, have use [[uiapplication sharedapplication] openurl:nsurl urlwithstring] open it.

so can try:

if ([[uiapplication sharedapplication] canopenurl: [nsurl urlwithstring:@"comgooglemaps://?center=46.414382,10.013988&mapmode=streetview"]]){     [[uiapplication sharedapplication] openurl: [nsurl urlwithstring:@"comgooglemaps://?center=46.414382,10.013988&mapmode=streetview"]]; } 

it use canopenurl, method check if trying open app not present in device can show alert of feedback user instead of not working button without "visual" action user.

hope helps.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -