uti

How do you get the Finder “Kind” for a file?

旧城冷巷雨未停 提交于 2019-12-07 03:12:26
I want to get the Finder "Kind" for a file. For example, for a file "foo.css", I want the string "CSS style sheet". So far, I'm doing something like this: NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: filename]; NSString *utiType; NSError *error; BOOL success = [fileURL getResourceValue: &utiType forKey: NSURLTypeIdentifierKey error: &error]; if (!success) { NSLog(@"failure during reading utiType: error = %@", error); return; } NSString *utiDescription = (__bridge NSString *) UTTypeCopyDescription((__bridge CFStringRef) utiType); if (utiDescription) { // use utiDescription here... }

Custom UTI does not work for iMessage in iOS 10

自闭症网瘾萝莉.ら 提交于 2019-12-06 17:27:55
问题 I defined and used a custom UTI type for my iOS app for iOS 9. Now, after using XCode 8 and iOS 10, I cannot "open" the file, if it is sent via iMessage. If I tap on the icon, nothing happens, although the correct icon is displayed. If it is sent via E-Mail, I can still import it to my app. Is there a difference for mail and iMessage? My info.plist declarations look like this: <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFiles</key> <array> <string>Icon-60@3x</string>

How to define a Uniform Type Identifier in a plist file?

做~自己de王妃 提交于 2019-12-06 15:44:39
My application uses the following NSApplicationDelegate function. - (void)application:(NSApplication*)sender openFiles:(NSArray*)filenames; I want to use this function to enable the user to drag and drop image files onto the application icon in the dock. How do I have to define certain file types in my plist file to restrict them to be images? I found out the structure has to look something like this. // plist file contents taken from Preview.app [...] <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFile</key> <string>jpeg.icns</string> <key>CFBundleTypeRole</key> <string

How to send and receive custom data with AirDrop

£可爱£侵袭症+ 提交于 2019-12-06 11:06:10
问题 I've been struggling with this for ages now as I can't find any detailed examples. In my app I have an array of custom data that I want to send to another user with the same app, via AirDrop. The first step is sending the data: @IBAction func share_Button_Click(sender: UIBarButtonItem) { let dataToShare: NSData = getMyCustomNSData() let controller = UIActivityViewController(activityItems: [dataToShare], applicationActivities: nil) controller.excludedActivityTypes =

Associate image file types (UTIs) with iOS App — Doesn't show 'Open in…' in mail / safari

狂风中的少年 提交于 2019-12-06 05:25:03
问题 I have an app that opens multiple file types, but image files seem to be a different story. In Mail and Safari, the options for most file types with associated apps are 'Open In...' or 'Open In [AppName]' (if there is only one), however, since images are embedded as rich-text within emails and web pages, the option only exists to 'Save Image' and 'Copy' Is it possible to associate an iOS app with image file types, and open images directly in the app, or do they have to all be saved to the

Show Icons for Custom UTIs in UIDocumentPickerViewController

心已入冬 提交于 2019-12-05 17:01:18
The iOS app I'm working on exports a UTI. The relevant parts of the Info.plist look like this: <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.xml</string> <string>public.data</string> </array> <key>UTTypeDescription</key> <string>GPX Document</string> <key>UTTypeIdentifier</key> <string>de.company.app.gpx</string> <key>UTTypeSize320IconFile</key> <string>Doc320.png</string> <key>UTTypeSize64IconFile</key> <string>Doc64.png</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>gpx</string>

Custom UTI does not work for iMessage in iOS 10

痞子三分冷 提交于 2019-12-04 23:21:15
I defined and used a custom UTI type for my iOS app for iOS 9. Now, after using XCode 8 and iOS 10, I cannot "open" the file, if it is sent via iMessage. If I tap on the icon, nothing happens, although the correct icon is displayed. If it is sent via E-Mail, I can still import it to my app. Is there a difference for mail and iMessage? My info.plist declarations look like this: <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFiles</key> <array> <string>Icon-60@3x</string> </array> <key>CFBundleTypeName</key> <string>My Voting Lists File</string> <key>CFBundleTypeRole</key>

How to send and receive custom data with AirDrop

主宰稳场 提交于 2019-12-04 16:46:43
I've been struggling with this for ages now as I can't find any detailed examples. In my app I have an array of custom data that I want to send to another user with the same app, via AirDrop. The first step is sending the data: @IBAction func share_Button_Click(sender: UIBarButtonItem) { let dataToShare: NSData = getMyCustomNSData() let controller = UIActivityViewController(activityItems: [dataToShare], applicationActivities: nil) controller.excludedActivityTypes = [UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo, UIActivityTypePrint,

Associate image file types (UTIs) with iOS App — Doesn't show 'Open in…' in mail / safari

久未见 提交于 2019-12-04 09:08:01
I have an app that opens multiple file types, but image files seem to be a different story. In Mail and Safari, the options for most file types with associated apps are 'Open In...' or 'Open In [AppName]' (if there is only one), however, since images are embedded as rich-text within emails and web pages, the option only exists to 'Save Image' and 'Copy' Is it possible to associate an iOS app with image file types, and open images directly in the app, or do they have to all be saved to the photo library, then imported from there (please say no!) Here are the image file associations from my

Document Types vs. Exported and Imported UTIs

[亡魂溺海] 提交于 2019-12-04 07:34:16
问题 Can anyone explain to me the difference between Document Types, Exported UTIs and Imported UTIs in Xcode 5.1? I want to be able to have my app automatically detect file type based on file extension. Which of these three would I need to implement in order to do that? 回答1: You add a Document Type to register that your app can open that Document Type, this is simple when you select a known file type, but if the file type is not known, you must also define it in Imported UTIs . And if you are the