Recognizing iOS file packages (in Simulator and Finder) - ios

I am trying to use file packages for an iOS app be defining an UTI type. After googling and looking at the entries in Xcode.plist, I tried a few things but kept running into problems. My app creates a few test documents and then tries to read those files with my custom UTI.
If I don't specify "LSItemContentTypes", then finder correctly sees them as packages. But then mdls returns "dyn.longstring" as kMDItemContentType.
If I do specify "LSItemContentTypes", then the kMDItemContentType is correct. But finder sees it as a folder.
In both cases the UTI I get via
[url getResourceValue:&UTI
forKey:NSURLTypeIdentifierKey
error:nil];
is incorrect. It either returns "dyn.longstring" or "public.folder". My app doesn't load these files because of the incorrect UTI. I could rewrite this but want to do it the right way with UTI's.
I defined an iOS file package as document type and exported UTI type as can be seen below. What am I overlooking?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tdp</string>
</array>
<key>CFBundleTypeName</key>
<string>MyFilePackage</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>reverse.dns.ios.package</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Default</string>
<key>LSIsAppleDefaultForType</key>
<true/>
<key>LSTypeIsPackage</key>
<true/>
</dict>
</array>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename.extension</key>
<array>
<string>tdp</string>
</array>
</dict>
<key>UTTypeIdentifier</key>
<string>reverse.dns.ios.package</string>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
<string>public.composite-content</string>
</array>
</dict>
</array>
</plist>

Was having a similar issue, including the UTI showing up as "dyn.longstring". Seems like the fix was to remove CFBundleTypeExtensions attribute (which is deprecated). This combination in the info.plist worked for me:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>My App Name</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>my.content.type</string>
</array>
<key>LSTypeIsPackage</key>
<true/>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
<string>public.composite-​content</string>
</array>
<key>UTTypeDescription</key>
<string>My App Name</string>
<key>UTTypeIdentifier</key>
<string>my.content.type</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>myextension</string>
</dict>
</dict>
</array>

Related

How to access the url of file when app launched from 'share' menu in swiftui

I have a pdf that I want to analyze when I open it with my swiftui app (iOS 14.1).
I've configured the info.plist of my app to declare it can open pdf files
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pdf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>app.icns</string>
<key>CFBundleTypeName</key>
<string>public.pdf</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.pdf</string>
</array>
</dict>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>PDF</string>
<key>public.filename-extension</key>
<array>
<string>pdf</string>
</array>
<key>public.mime-type</key>
<string>application/pdf</string>
</dict>
</dict>
</array>
</dict>
</plist>
Now, when I click on the pdf file (in file manager or in an email), and select my app in the 'share' menu, it opens my app exactly how I wanted.
But I have no clue about how to get the url of the file (or directly the file content) inside my app.
I've tried using .onOpenURL modifier but it never seems to be called.
Is it only called from schemes url?

How to include multiple app URLs in manifest for over-the-air installation

Internally I have a 4-step process for testing (each is an environment): dev, build test, user acceptance testing and production.
Currently, I'm not using TestFlight and am having to create a manifest with the respective URL given each environment above. There's repetitive work.
Is there a way support multiple app URLs inside the manifest for over the air installation? Can I do it without TestFlight?
Yes, you can inclide multiple .ipa links within a single .plist. You just include multiple asset dictionaries in your plist. We do this to offer a single "bundle" install of multiple internal apps. Here is an example of a plist with two apps (app1 and app2) make sure you update the url, bundle-identifier, and title for each app you include in the bundle.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://server/app1.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.company.app1</string>
<key>bundle-version</key>
<string></string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string></string>
<key>title</key>
<string>App description 1</string>
</dict>
</dict>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://server/app2.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.company.app2</string>
<key>bundle-version</key>
<string></string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string></string>
<key>title</key>
<string>App description 2</string>
</dict>
</dict>
</array>
</dict>
</plist>

Download inhouse app from another app programmatically

we have a lot of inhouse apps and want an app like AppStore. We did a demo. We can open installed apps but apps,not installed on iPhone, can't be downloaded from our servers to the iPhone.
We do:
if([UIApplication sharedApplication] canOpenURL:..] == false){
NSString *schemelink = [NSString stringWithFormat:#"itms-services://?action=download-manifest&url=%#",**plist_url**];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:schemelink]]
}
The things that we do to find the reason:
Copy-paste plist url to the Mac Safari and I check the plist and it's correct everything(ipa links and others). They all at the same path.
Copy-paste just ipa url. It started to download on Mac.
Copy-paste ipa url with itms-services://?action=download-manifest&url=, it says
There is no application set to open the URL ......ipa
Search the App Store for an application that can open this document, or choose an existing application on your computer.
How can I solve it?
.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://....../AppName.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.company.AppName</string>
<key>bundle-version</key>
<string>1.3</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>AppName</string>
</dict>
</dict>
</array>
</dict>
</plist>
Your plist file should be hosted on HTTPS SSL enabled serve only otherwise you can not install it.
I have attached a sample manifest.plist file with sample data, you can modify with your original one.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://127.0.0.0/app/App.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>url</key>
<string>https://127.0.0.0/app/icon57.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>url</key>
<string>https://127.0.0.0/app/icon512.jpg</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.companyname.appname</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>Your application name</string>
</dict>
</dict>
</array>
</dict>
</plist>
Place all the following files in same directory on your server.
App.ipa
icon57.png
icon512.jpg
manifest.plist
Your download URL should look like following.
itms-services://?action=download-manifest&url=https://127.0.0.0/app/manifest.plist
Example Click here to download App.
Also make sure your server supports MIME Type of application/octet-stream for ipa and text/xml for plist.

Ad Hoc doesn't get downloaded

I want to distribute my iOS app by Ad Hoc. Since the current version of XCode doesn't create .plist file, so I got one from StackOverflow and filled it as blow.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://hungry.portfolio1000.com/HungryHandongi.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.Akadev.HungryHandongi</string>
<key>bundle-version</key>
<string>1.06</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>배고픈 한동이</string>
</dict>
</dict>
</array>
</dict>
</plist>
The url of the .plist file is: https://dl.dropboxusercontent.com/s/tulw9h412me6ayh/HungryHandongi.plist?dl=0
Now I want to let people download the app through the url http://hungry.portfolio1000.com/hungryhandongi.html which is coded like below:
</head>
<body>
<ul>
<li>Download</li>
</ul>
</body>
</html>
When I open the url with Safari and click 'Download' link, nothing happens. I want know what I've done wrong.
Thank you.
I think you are getting this issue for iOS 8.
Yes for Over the air distribution you need to create plist file manually. and you have to change your identifier like
com.Akadev.HungryHandongi to com.Akadev.HungryHandongi.iOS8fix
Please check below plist , it will help you
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://www.path.com/build/iphone/some/2015/022015/name/appname.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://www.name.com/build/iphone/EnterpriseTB/2015/022015/some/iTunesArtwork.png</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://www.some.com/build/iphone/some/2015/022015/some/Icon.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>mobi.somecmp.appname.ios8fix</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>appname 2015</string>
</dict>
</dict>
</array>
</dict>
</plist>
Note: For ADHoc Distribution device id should be added into your provisioning profile.

Setting iTunes category on iOS Enterprise app

I've been trying for a while now to preset the iTunes category for an enterprise app to no avail.
Been playing with the iTunesMetaData.plist file hoping that would override the "unknown genre" titling, but can't get it to stick:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>appleId</key>
<string></string>
<key>artistId</key>
<integer>0</integer>
<key>artistName</key>
<string>namehere</string>
<key>buy-only</key>
<true/>
<key>buyParams</key>
<string></string>
<key>copyright</key>
<string></string>
<key>drmVersionNumber</key>
<integer>0</integer>
<key>fileExtension</key>
<string>.app</string>
<key>genre</key>
<string></string>
<key>genreId</key>
<integer>0</integer>
<key>itemId</key>
<integer>0</integer>
<key>itemName</key>
<string>namehere</string>
<key>kind</key>
<string>software</string>
<key>playlistArtistName</key>
<string>namehere</string>
<key>playlistName</key>
<string>namehere</string>
<key>price</key>
<integer>0</integer>
<key>priceDisplay</key>
<string>nil</string>
<key>rating</key>
<dict>
<key>content</key>
<string></string>
<key>label</key>
<string>4+</string>
<key>rank</key>
<integer>100</integer>
</dict>
<key>releaseDate</key>
<string>Sunday, December 12, 2011</string>
<key>s</key>
<integer>143441</integer>
<key>someicon.png</key>
<string></string>
<key>softwareIconNeedsShine</key>
<false/>
<key>softwareSupportedDeviceIds</key>
<array>
<integer>1</integer>
</array>
<key>softwareVersionBundleId</key>
<string>com.mycompany.myapp</string>
<key>softwareVersionExternalIdentifier</key>
<integer>0</integer>
<key>softwareVersionExternalIdentifiers</key>
<array>
<integer>1466803</integer>
<integer>1529132</integer>
<integer>1602608</integer>
<integer>1651681</integer>
<integer>1750461</integer>
<integer>1930253</integer>
<integer>1961532</integer>
<integer>1973932</integer>
<integer>2026202</integer>
<integer>2526384</integer>
<integer>2641622</integer>
<integer>2703653</integer>
</array>
<key>vendorId</key>
<integer>0</integer>
<key>versionRestrictions</key>
<integer>0</integer>
</dict>
</plist>
I always get the "unknown genre" whenever I add the build to iTunes (I can get the iTunesArtwork image to show up btw).
I've tried with and without all values filled out above, etc.
Maybe I'm just missing something simple?

Resources