TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

iOS Document App Template has upload issues related to UTTypes

Forums > SwiftUI

My app started from the iOS Document App template. I recently tried to upload it to App Store Connect (for TestFlight) and got error messages. So, I created a new app from the iOS Document App template in Xcode 14.2, changed only 1 thing (to be like my app), tried to upload it, and get the same error messages.

The one thing I changed was essentially in the info.plist. Using Xcode, in "Info", I changed Imported Type Identifiers, Extensions, from "exampletext" to "txt". My app reads and lets users edit plain-text files and saves new files with the extension ".txt".

Please let me know how to fix this. I'm a newbie, so details are very helpful. If there's a document, website, or YouTube that I should review, please let me know.

Here are the messages during upload:

Distribution failed with errors:

Asset validation failed. Disallowed UTTypes value. The Info.plist key 'LSItemContentTypes' under 'CFBundleDocumentTypes' in 'DocTemplate.app' has disallowed values '[com.example.plain-text]'. A Uniform Type Identifier starting with one of the patterns in the list '( "com.example.")' is disallowed. (ID: 80fc7e4d-9d35-4871-9684-ad7feba7b928)

Asset validation failed. Disallowed UTTypes value. The Info.plist key 'UTTypeIdentifier' under 'UTImportedTypeDeclarations' in 'DocTemplate.app' has disallowed values '[com.example.plain-text]'. A Uniform Type Identifier starting with one of the patterns in the list '( "com.example." )' is disallowed. (ID: b9165f4d-0098-42bf-a25a-9dd251e4e941)

Asset validation failed. This bundle is invalid. The value of the CFBundleDocumentTypes key in the Info.plist must be an array of dictionaries, with each dictionary containing at least the CFBundleTypeName key.

1      

The error message tells you what you need to do to correct the issue:

The Info.plist key 'LSItemContentTypes' under 'CFBundleDocumentTypes' in 'DocTemplate.app' has disallowed values '[com.example.plain-text]'. A Uniform Type Identifier starting with one of the patterns in the list '( "com.example.")' is disallowed.

You can't use com.example but have to use the identifier from your app. So com.myapp or whatever your bundle identifier happens to have been set to when you created the project.

1      

Thanks @roosterboy. I made some changes, and now get: This bundle is invalid. The value of the CFBundleDocumentTypes key in the Info.plist must be an array of dictionaries, with each dictionary containing at least the CFBundleTypeName key.

So, I obviously need to add a CFBundleTypeName key - would you advise on this too?

I'd like my app to edit plain text files (and create them with .txt extension) - which it does in the simulators - but not be the default app for editing text files. Is "Viewer" correct for the TypeRole?

Any other additions or changes I likely need? I'm obviously a super newbie at this.

Here's my current info.plist (but with my company and appname changed):

<?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>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>com.MyCompany.ThisAppName</string> </array> <key>NSUbiquitousDocumentUserActivityType</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER).example-document</string> </dict> </array> <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.plain-text</string> </array> <key>UTTypeDescription</key> <string>Example Text</string> <key>UTTypeIconFiles</key> <array/> <key>UTTypeIdentifier</key> <string>com.MyCompany.ThisAppName</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>txt</string> </array> </dict> </dict> </array> </dict> </plist>

1      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.