Handle URL open from other apps in iOS

For short, declare UTImportedTypeDeclarations(for types that are not predefined as System Uniform Type Identifiers), CFBundleDocumentTypes in Info.plist, UIApplicationLaunchOptionsURLKey in

[launchOptions valueForKey:UIApplicationLaunchOptionsURLKey]

And for multitask apps, additionally respond to

(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation // for iOS 4.2+

or

(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url // for iOS 2.0+, deprecated.

One little trick to handle ALL file types:

	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeName</key>
			<string>All Files</string>
			<key>LSItemContentTypes</key>
			<array>
				<string>public.data</string>
				<string>public.content</string>
			</array>
		</dict>
	</array>
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
This entry was posted in Default and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">