Choosing what Iphone app must open one url schema - iphone

I'm able to open a url scheme with my apps. However i can have more that one app with the same
url scheme registered so i would like let user choose the default app for the scheme.
I need to use the same scheme for all my apps. Now by default iphone uses the last app installed that can open the schema.
Have you same idea to solve my problem?
Do you know if is possible inside an app choose itself as default to open a url scheme?
I can't find the possibility to do this in generale setting of Iphone.
Thanks you

It is not supported. Here is a note from Apple documentation.
If your URL type includes a scheme
that is identical to one defined by
Apple, the Apple-provided application
is launched instead of your
application. 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.
Implementing Standard Application Behaviors
A possible solution would be to have your apps connect to the your server to get a list of your apps and their supported URL schemes. You can present that list to the user and the user can select the default app.

Related

Is it possible for native iOS application to interact with Safari browser?

I would like to enable interaction between a native iOS application and the Safari browser such that tapping a right click on an image on a webpage provides an option in the context menu to send the image to another custom written native iOS application for further processing and/or storage.
However, according to this article from Safari Developer Library, “Safari extensions are not currently supported on iOS”.
Is there any other alternative to achieve the above functionality?
You have multiple choices here:
You could register in your application's Info.plist file that your app known how to handle certain type of documents (see here in Apple's doc). This way when your iPhone encounters this document type, iOS will propose the user to open this document in your app; for example if you register for the PDF type and you then tap on a PDF document as an attachment in a mail, you app will be listed in the proposed menu and will then be opened with the document as a parameter.
But it seems that even if this works perfectly for any type like DOC, PDF, or even custom types, it does not work for images, which seems to be handled in a separate way by iOS :(
A simpler way would be to register, still in your application's Info.plist, any custom URL schemes. See here and below in the Apple's doc. For example when, anywhere in your iPhone (either in your own app, or in another third-party app, including Safari), it encounters URLs like "myapp://xxx/yyy/zzz", it opens your app, passing this URL as an argument. You can then do whatever you want with this URL.
The solution then is to add some code in your web page so that when the image is tapped, you ask Safari to open the URL "myimageditor://edit?url=http://www.url.of/your/image.jpg". If you registered for the "myimageeditor://" URL scheme, you app will then open with the URL in the parameters, and you then will be able to retrieve the image using the embed URL.
I think it is possible only for jailbroken devices.

Find all registered mime-types / url scheme protocols (intent filters) on iOS ( iPhone / iPad / iPod )

I'm a mobile web developer, and I'd like to test a few iOS devices to see what mime-types and url schemes the average iOS device can accept.
On Android I'm able to install an app called PackageExplorer that lists all the "intent filters" for all the apks and lists what file mime-types (image/png, text/html, text/x-vcard) and url schemes (like geo:, tel:, sms:, mailto:, http://youtube.com) the app handles.
It would be really nice if I could tell what schemes and mime-types are supported/registered from the server or browser side on my mobile webpages, but if that's not possible, I'm looking for a display or an app in iOS to view all the registered file mime-types and url scheme protocols that the device currently supports with all it's installed apps.
How do i find all the registered scheme/mime intent filters on an iOS device?
UPDATE: I don't know if it's complete, but I found an official list of url schemes sported in mobile safari: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html (still looking for mime-types etc.)
This information is not available per se. You can however build an app that tries out content of varying types with different content-types and look whether this displays nicely or doesn't.
We've had one situation where the content type for Powerpoint was not registered on the web server and thus UIWebView was unable to display it. It will in these cases respond with a specific error code instead of didFinishLoading. When it was fixed on the server it started working in the app as well.
A slight complication there is that the test files would have to served by a web server because fileURL-based documents don't have a content type. There webkit inside UIWebView auto-detects the file type.
Though in all likelihood this information will prove to be useless to you for a simple reason: apps can always register to open certain file types on the device. The document interaction controller can be used to hand off the opening of the content in this other app. And since this extends the number of viewable document types infinitely you can never how to have a complete list.
So what you really would want is a list of these types of files that UIWebView can display, but you have this list already, you have quoted Apple's URL in your question.

Using another one application in one Iphone Application?

anytutorial to use good reader application in iphone sdk?
can I use Good reader application in my Iphone APplication?
To launch another application you have to find out if they have published a protocol to use and then 'open' that URL. See example, but not sure if GoodReader has published a protocol or how to find out if they have. You could always contact the developer directly.
You can't access another applications Sandbox or start another application via code, otherwise Apple will reject the app. I stand corrected to the answer about URL schemes to launch another app. You learn something new everyday.
You [can also] build the PDF functionality into your own app (i.e. use a UIWebView to do that for you).

How can two iPhone applications share the same settings?

Can two different iPhone applications share the same settings? I'm releasing two iPhone products, one that requires the user to login to use, the other that is free and can be used without a login. However, the second free application could have some enhancements that we could give if the user were logged in. Would it be possible to let a user who has both apps installed use the same settings module for the username/password we store on the device?
I don't think this is possible. I believe that each Settings module that is related to your app ID, which will be different for each app. It would be a security risk if one application could access another's settings.
I think the best solution is to use some sort of web service to store/retrieve the settings. Or you could use a custom URL scheme to pass data between the applications if you don't want to use a web service.
Natively I dont think its possible. But interfacing with an Internet Web Service, you could do it.

iPhone - Open Application from Web Page

This sounds odd. In fact, it sounds like a security risk to me. However, I would swear that I have seen web pages that you can click a link on and it opens the app store on the iPhone.
My question is, is it possible to launch any application from through a web page? Can parameters be passed to the application? I do not need technical details. I'm just curious if it is possible.
Thank you,
Yes. From Control and configuration of applications through Info.plist - Invoking your iPhone application by URL:
Invoking your iPhone application by URL
The CFBundleURLTypes key allows you to specify URL schemes that will cause the iPhone to switch to your application. No, you can't override the schemes for the built-in applications.
If your application is launched using a URL type named scheme, then you can also provide a different startup image "Default-scheme.png" instead of the regular "Default.png".
See iPhone file extension app association for more details.