Check if iphone has Square app installed - open or install - iphone

In my code, I need to determine if an app has been installed on the iphone device or not (the app I need to check is Square). If the app isn't installed, I would to open the app directly to Square, and if it is installed, I would like to open Square. Is there a way to do this? I checked out this discussion: iphone - Check if an app is installed , but wasn't able to work it out. Since I was not a developer of Square, where do I get the information about the URL scheme?
Thanks.

It doesn't necessarily HAVE a scheme. The developers would have had to do that, and to have a reason to support incoming URLs. I don't know whether they've done that, or if they've documented it, or anything.
Assuming there's no documentation, then you can stab at it and see what you get. If you've got a guess at the scheme ("square:", perhaps?) you can test it with the canOpenUrl method of UIApplication:
UIApplication *app = [UIApplication sharedApplication];
if ([app canOpenURL:[NSURL URLWithString:#"square:"]]) {
NSLog(#"found it!");
}
If "square:" is a URL scheme that any app on the device has declared, this code will tell you so in the console.

Related

iTunes app link cannot open page in safari in simulator and also iDevices

I hope this may be duplicate question. But none of the answers didn't hard help me. I am trying to open a link from my iOS application. When I press the button, It opens the safari app and it always says an alert "Safari cannot open the page because the address is invalid". Here it is a link looks like the same https://itunes.apple.com/gb/app/app_name/id(appId) .
I don't think it is a good place to post the exact the app link. So the above link is dummy link exactly look like mine. Why the error always happening when I try to open the link. I tried in simulator and also in iPod. Same error occurs. If I try the same link with Safari in MAC OS then it works.
Here it is a code I am using to open the safari from my app with a link.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/gb/app/app_name/id(appId)"]];
I am from India. The above link contains gb. Is that link can only open from Great Britain??
UPDATE:
I have good working network. And I tried one more thing. I opened my safari app in simulator and search my app in google and clicking that link shows the same error. Is that a problem with that link in apple side itself??
Kjuly's answer is 90% correct (and +1 to Kjuly!).
If you look at the at the Appirater code,
and in the .m file that has the function that opens up the app store (it's the "rateApp:" method) I see this bit of code:
+ (void)rateApp {
#if TARGET_IPHONE_SIMULATOR
NSLog(#"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
So no matter what you try, you are not going to be able to open the App Store app within the simulator. The App Store app does not exist in the simulator, so that's why you get a "not found" error when your web view attempts to redirect to it. This should work fine on the actual device that has the App Store app installed.
Take a try with this URL:
http://itunes.apple.com/app/<appId>
Note: Replace <appId> with your desire App's ID, e.g. id543028543.
That is a possibility as you are specifying the region to which the app belongs or is hosted on the app store under. Try loading the the url without the region 'gb'.
I was having same problem. Links in email not opening, links to App Store not working and App Store not searching or loading apps. I called Appke support. A reset worked! Go to settings to find how the reset under general. It doesn't delete anything either.

Access the Apps available in iphone

Hi i would like to access the apps which are available in iphone means downloaded apps and inbuild apps.But here issue is if i access any app which is available in iphone using [[UIapplication sharedapplication]openurl:[NSURl url urlwithstring:#"http://www.skype.com"]] like this i can able to access that iphone app succesfully but if i want to come back to my app i did not find any way only i have to hit homebutton. So is there anyway to come back to my app at any point of time. if anyone know please let me know. Thanking you.
So is there anyway to come back to my app at any point of time.
Not unless the other app supports returning back to the calling app (by responding to a special specifier in the URL, for example).
Note that there is also -[UIApplication canOpenURL:] which will tell you if a particular URL scheme is supported. This is useful to check whether a particular app is installed without attempting to launch it.
That is default behavior of the iOS application. Once your application is in background there is no way to come back to your application programatically.
User has to manually open your application.
You can navigate to some other apps on the phone using the URL method, however you cannot return to your app.
Once you navigate to the other app, it takes over and your app is no longer running. Therefore, the other app would need to navigate back to you. That obviously is not possible, unless you had access to the code of the other app.

Launch iPhone Application with Identifier

I'm trying to Launch an application within my App.
For example: If I press a Button in my testApp1, it should Open up testApp2.
Is there any Way to do this with the App Identifier??
I heard something about a undocumented method called launchApplicationWithIdentifier: suspend: but that doesn't work for me, or i'm using it wrong.
I tried this:
[UIApplication launchApplicationWithIdentifier:#"com.test.testApp2" suspend:NO]
But it didn't work.
Better use [[UIApplication sharedApplication] openUrl:]. You'll need set a custom URL scheme in your second app for that. Check this tutorial or simply do a search with "iphone custom URL schemes". There's a lot of good tutorials.
I am not sure but i guess launchApplication is used for mac app thats why its showing warning. i will suggest you to create a custom URL and add it to plist file and then later you may launch your app using that url.

Find App installed or not

How to find the app is installed in device.
If you look for an application that registers a URL scheme that it can open, then you can check for the presence of that app using the UIApplication -canOpenURL: method, as documented here: Apple Docs ; otherwise it is not possible normally from the SDK.

Using twitter:// tweetie:// custom scheme on iPhone to open twitter application to a specific user profile

I thought I was familiar with the applications custom schemes used with iOS to trigger applications from my app but I'm unable to use the ones that seems to be provided by the official twitter app (aka tweetie).
I'm trying to open the twitter application directly to a predefined user profile.
From the documentation found here http://handleopenurl.com/scheme/twitter this should be feasible, but this code doesn't work :/ :
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"twitter://user?id=41553213"]];
I also tried with tweetie:// but the same happens : the application launches, but does not "jump" to the given user profile.
Actually, if I try any of the other examples, I don't get anything working :(
twitter://messages
twitter://mentions
none of them are working :(
Any idea why none of those invocations are working ?
Thanks.
N.B:I'm using the last version of the twitter application under iOS 3.1.3 (iphone 3G)
very strange, after removing the application, downloading it again from the appstore, it appears it works ? :O Maybe I wasn't exactly on the very last one ?! At first I thought it was because I had multiple accounts set up, but no, even with that it works now. Strange, but cool.