URL scheme in iOS - iphone

I have added an URL scheme to my application. The URL scheme is testapp://. While I entered the text testapp:// in Safari and on hitting return, it launched my application.
Then I tested with testapp://placeid=12. This is launching the TestApp in iPad but in iPhone, I am getting Cannot Open Page and I am not able to test.
I could pass the placeid=12 as URL query. But what I would like to know is, why it is not opening in iPhone alone.
Any idea on this?
Note: Irrespective of device types, it seems to be iOS issue. This is the behaviour from iOS 6 and above.

Could it be that each device is running a different iOS version?
If so, please take into account some details depending on the version. For example, if you read the Advanced App Tricks, there is a section that may help you:
Handling URL Requests
An app that has its own custom URL scheme must be able to handle URLs passed to it. All URLs are passed to your app delegate, either at launch time or while your app is running or in the background. To handle incoming URLs, your delegate should implement the following methods:
Use the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods to retrieve information about the URL and decide whether you want to open it. If either method returns NO, your app’s URL handling code is not called.
In iOS 4.2 and later, use the application:openURL:sourceApplication:annotation: method to open the file.
In iOS 4.1 and earlier, use the application:handleOpenURL: method to open the file.
Hope this helps. Otherwise, I will really recommend you to stick to the standards. It would make your life easier :)

It is possibly not working because testapp://placeid=12 is not a valid URL. You will need a domain address there too, like testapp://localhost/query?placeid=12. It is possible the '=' character is causing the error.
I am not able to test it right now so let me know.

As mentioned in the question's note, it is iOS 6's Safari browser behaviour. We could not have "=" in the host of the URL while entering in Safari.
Instead, I solved this problem in the following manner.
Sent the URL in mail, and from Mail, if I click the URL, the app was launched. But the important point is, I had to parse the URL host to get the value.

Related

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.

ooVoo URL Schema on iPhone

Anyone know if there's a URL schema for the ooVoo iPhone app?
For example, I'm able to launch the Skype app from my app using "skype:userName?call", but there doesn't appear to be an "oovoo:" URL tag. Did they simply forget to register their custom schema in the app? Or is it possibly named something different?
The following format in an href appears to be valid for the PC version "oovoo:?call?userName" while I was doing some digging, but doesn't work on the iPhone (the ooVoo app never launches). I tested the oovoo: tag from a webpage as well, and Safari just reports the address as invalid.
Thanks.
Try something more general like oovoo://www.google.com.
If you have ooVoo installed, and Safari cannot recognize the scheme, it doesn't exist.
The specific arguments and variables shouldn't matter until you get into the app.

more than one app has same URL Identifier for Custom URL Application?

i have used custom URL scheme in my Application to open it from another Application(which may be my Own).suppose more than one Application in App store may have The URL Identifier i used.if user has two Application with same URL Scheme, what will open? will Custom URL Application be approved by apple?
Custom URL apps are accepted by Apple. However if multiple apps on the device have registered same URL scheme then the behavior is undefined. From iOS Application Programming Guide, "If multiple third-party applications register to handle the same URL scheme, it is undefined as to which of the applications is picked to handle URLs of that type."
Short answer: First app to register URL will sometimes open but it will fail to open often. Other times second app to register will open but fail often. Basically it fails a lot and really is "undefined". Use http://handleopenurl.com/ to avoid.
Long Answer:
I created two apps, FirstApp and SecondApp, and registered the same URL testURL for both.
I loaded FirstApp and the URL worked as expected, opening the app.
I then loaded SecondApp and the dreaded undefined behavior started occurring. Currently, under iOS 7, if two apps have the same custom URL registered it pops up a modal asking
Open this page in "Name of First App"?
When you tap the Open option it fails, and nothing happens. If you tap or enter the link again the first app installed with that URL, in our case FirstApp, will launch.
So in effect, the second app to register never gets opened, and the first app fails every two URL calls. No ideal behavior.
What makes it even worse is I deleted both apps and then switched the order I installed them and the results are not consistent. Sometimes it is one app, then on reloading both apps it is the other. The behavior really is "undefined".
Best practice is to use http://handleopenurl.com/ to see what URLs have been registered and chose one that will not conflict with other apps. You can't "steal" another URL because you can't be sure your app will open and not the other app.
this may be your answer that you are finding
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
By reading this article It may be possible that apple can reject your application, still you can read the guide line provided by apple.
Thanks

How do I link to another app in the App Store in an iPhone app?

I used this technique, but it appears to not work anymore in 3.0. In the simulator at least, my app opens Safari, and then there is a visible redirect, but then I get a message that there has been too many redirects. Any fix?
Have you tried this on the device? There is no App Store application on the Simulator, so any attempts to redirect to it will fail.
Within my application, the itunes.apple.com links for the App Store work just fine under 3.0 on the actual devices.
I can't test this right now, but have you tried changing the 'http:' protocol in the link to 'itms:' instead?

End call, don't return to app automatic in iphone 3.1 version

my app use openURL to have a call, but when I end call, it will not return to my app automatic in iphone 3.1
Anyone know that?It's a bug of iphone 3.1?
Thank you very much!
It's not a bug, it's how it works. Once you use openURL to transfer control to another app such as the Phone, SMS, Mail or Safari, your app is closed and control transferred to the app you specified in your URL. When the user is done with the app you invoked, closing it will not reopen your application.
You may modify your application so that if the user receives an incoming call and decides to answer it, control is returned to your app when the user terminates the call. But this is of course different from what you asked for.
It does appear behavior has changed (for the better in my opinion)