forcing a file to open in predefined application in iOS - ios

I am trying a simple web app which downloads files from internet and saves on iPad. Theses files are of .pdf,.xls,.doc, etc format. Now, I want to assign a default application to open a specific file type. (Say Adode reader for pdf file, Some image viewer app for image files etc). I dont want my app/os to decide which app the file should open in. Instead, if assigned app doesnt exists then it should give me a message that no such app found. Is it possible to do?

With a web app you cannot do such things.
If you go native, you can use Custom URL Schemes (see http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html)
But with Custom URL Schemes, you only are able to pass a view parameters. If you want more, UIPasteboard is recommended.
Apps are sandboxed. You cannot access other apps, nor their data!!!
But on native apps you can pass over data with pasteboard, call a custom url handler, pass a few parameters to cause the other apps to process your data.
Often App developers, like camera+ offer a documentation for the usage of their custom url schemes (Camera+ URL Schemes API)

Related

iOS - How to send file from one app to other specific app

I want to send .pdf or image file from my app1 to app2 like instagram hooks. I don't want to show options. I want to send the file directly from app1 to app2 if app2 is installed.
At first I tried using custom URL schemes by modifiying this example. It is good for sending some strings but I couldn't find I way to send files with custom URLs. I've tried to encode file to base64 string and appending to URL. It didn't work. URL becomes broken.
Then I searched for implementing UIDocumentInteractionController Uti as Instagram and WhatsApp does. But I couldn't find any sufficient examples. This is the right way I guess but there isn't much information to go on.
How could I achieve this with the methods mentioned above? (App groups, keychain, pasteboard are not good options for me)
This is very old question, but I think, you tried to find something like this:
If you would like other applications to open your app based on a file type, you can register your document request in the application plist file. This provides a means to associate any file type with your iOS app.
Include the CFBundleDocumentTypes key, which is an array of dictionaries, where each entry defines information about the file type(s) your app supports.
Here are some useful links:
iOS Tips and Tricks: Associate a File Type with your App
How to register file types supported by an iOS app
How To Import and Export App Data Via Email in your iOS App

How to call out to another app within an app - iOS

We use an LMS calles Canvas by instructure. Our students access the LMS via the iOS app, however we would like to be able to call out from this app to another app (e-book reader).
We just want to be able to select a link which will redirect us to the app.
We have a coder in our staff, and we would really appreciate any advise on how to achieve the above.
You can communicate with URL Schemes between apps Apple Inter-App Communication
And here is Tutorial explaining URL Schemes implementation.
If you have access to the e-book reader app's codebase, this is simple to achieve by specifying a URL Scheme this app may respond to (or, alternatively, if you happen to know what URL Schemes this app supports). Then it will be as simple as calling out a URL of a corresponding format from within the iOS app your students use.
Alternatively, if your app provides access to the documents of some sort, you could look into UIDocumentInteractionController that can add "Open in..." functionality to your app, allowing app users to open a document in an arbitrary app that supports this file format.

How to show all apps receives strings in "Open In.." menu?

I'm totally new in iOS development. I'm developing an app processing some strings in UItextview. After the process, I want show "Open In.." menu with all applications can receive text values.
To explain more. What I mean is like this in Android http://developer.android.com/training/sharing/send.html
I took a quick look at the link you posted.
Apple enforces a "sandbox" around apps which greatly limits what you can do.
Off the top of my head here are a few ways to do it:
Define a custom URL scheme in each of your apps. One app would open a URL using the other app's URL scheme, and that would open the other app and pass it the URL.
For a family of apps from the same company you should also be able to set up a common base "bundle ID" and use that to read and write shared entries to the keychain. The keychain is limited to fairly short bits of data however. (It's intended for password strings and the like.)
I haven't used it before, but you should also be able to use the UIDocumentInteractionController class to pass a copy of a document between apps. As I understand it, the sending app presents a document and asks the user to pick an app with which to open the document. When the user picks a target app, the system creates a copy of the document in the target app's documents directory and then tells the target app to open it.

share core data between many users on app

I wanna develop an iOS app as the platform for many users. Is it possible to enable multiple users of my app to share resources on the same core data database?
The other alternative to iCloud (with the whole ownership issue) is to have an online server that stores the data remotely.
Then you can create a web service to store and retrieve the data from the server onto the device.
yes This can be done using a custom url scheme on the iphone by help of iCloud URL.
but it has some dark sides.If you use a custom url scheme, only one application "owns" the data. The other application would have to import data from the main application.
another method is system pasteboard i.e. clipboard. you can put stuff on it and then launch another application with a URL that tells the other app to check the pasteboard.There's also the system pasteboard .
for more information on custom URL scheme check this link

Is it possible to have access to the image specified in CFBundleURLIconFile via URL scheme from a different iOS app?

is it possible to access the icon specified with CFBundleURLIconFile in the info.plist file from a different application? Does application sandboxing prevent it? If so,what is the purpose of this key(in an iOS app of course)?
Thanks
As stated in CoreFoundationKeys docs: "CFBundleURLTypes contains an array of dictionaries, each of which describes the URL schemes (http, ftp, and so on) supported by the application. The purpose of this key is similar to that of “CFBundleDocumentTypes,” but it describes URL schemes instead of document types."
The purpose is to permit applications to register for some type of documents allowing an app to handle the opening of files from other installed app (you surely met the "Open In..." button, for example in Mail when you receive a file).
More on this in the Document Interaction Programming Topics for iOS.
EDIT:
Sorry, I forgot to answer to your main question: AFAIK the only way to access that key is through UIDocumentInteractionController.

Resources