iOS Question Custom file type in iOS

Nickelgrass

Active Member
Licensed User
Longtime User
Hello,
I have a custom file type declaration in B4I using the plistextra. The file has the extension PCD and is basically just a plain text (similar to xml) file. But I get an error:

Error:
error: Bundle identifier is missing. B4iProject doesn't have a bundle identifier. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor. (in target 'B4iProject' from project 'B4iProject')

I added this line on top and in the declaration which does not change anything:
PlistExtra:
#PlistExtra:        <key>NSLocationUsageDescription</key><string>Used To display the current navigation data.</string>

My declaration looks like this:

Code:
    #PlistExtra:<key>UTExportedTypeDeclarations</key>
    #PlistExtra:<Array>
    #PlistExtra:    <dict>
    #PlistExtra:        <key>UTTypeConformsTo</key>
    #PlistExtra:        <Array>
    #PlistExtra:            <string>Public.text</string>
    #PlistExtra:        </Array>
    #PlistExtra:        <key>UTTypeDescription</key>
    #PlistExtra:        <string>Some string</string>
    #PlistExtra:        <key>UTTypeIdentifier</key>
    #PlistExtra:        <string>Public.pcd</string>
    #PlistExtra:       <key>UTTypeIconFiles</key>
     #PlistExtra:       <Array />
    #PlistExtra:        <key>UTTypeReferenceURL</key>
    #PlistExtra:        <string>https://www.something.com</string>
    #PlistExtra:        <key>UTTypeTagSpecification</key>
    #PlistExtra:        <dict>
    #PlistExtra:            <key>Public.filename-extension</key>
    #PlistExtra:            <Array>
    #PlistExtra:                <string>pcd</string>
    #PlistExtra:            </Array>
    '#PlistExtra:            <key>Public.mime-Type</key>
    '#PlistExtra:            <string>text/plain</string>
    #PlistExtra:        </dict>
    #PlistExtra:    </dict>
    #PlistExtra:</Array>

    #PlistExtra:<key>CFBundleDocumentTypes</key>
    #PlistExtra:<array>
    #PlistExtra:    <dict>
    #PlistExtra:        <key>CFBundleTypeName</key>
    #PlistExtra:            <string>My file type</string>
    #PlistExtra:        <key>LSHandlerRank</key>
    #PlistExtra:            <string>Alternate</string>
    #PlistExtra:        <key>LSItemContentTypes</key>
    #PlistExtra:            <array>
    #PlistExtra:                <string>Public.pcd</string>
    #PlistExtra:            </array>
    #PlistExtra:    </dict>
    #PlistExtra:</array>

What could this be? It works fine if I just use the standard TXT files without the declaration.
 

walterf25

Expert
Licensed User
Longtime User
Hello,
I have a custom file type declaration in B4I using the plistextra. The file has the extension PCD and is basically just a plain text (similar to xml) file. But I get an error:

Error:
error: Bundle identifier is missing. B4iProject doesn't have a bundle identifier. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor. (in target 'B4iProject' from project 'B4iProject')

I added this line on top and in the declaration which does not change anything:
PlistExtra:
#PlistExtra:        <key>NSLocationUsageDescription</key><string>Used To display the current navigation data.</string>

My declaration looks like this:

Code:
    #PlistExtra:<key>UTExportedTypeDeclarations</key>
    #PlistExtra:<Array>
    #PlistExtra:    <dict>
    #PlistExtra:        <key>UTTypeConformsTo</key>
    #PlistExtra:        <Array>
    #PlistExtra:            <string>Public.text</string>
    #PlistExtra:        </Array>
    #PlistExtra:        <key>UTTypeDescription</key>
    #PlistExtra:        <string>Some string</string>
    #PlistExtra:        <key>UTTypeIdentifier</key>
    #PlistExtra:        <string>Public.pcd</string>
    #PlistExtra:       <key>UTTypeIconFiles</key>
     #PlistExtra:       <Array />
    #PlistExtra:        <key>UTTypeReferenceURL</key>
    #PlistExtra:        <string>https://www.something.com</string>
    #PlistExtra:        <key>UTTypeTagSpecification</key>
    #PlistExtra:        <dict>
    #PlistExtra:            <key>Public.filename-extension</key>
    #PlistExtra:            <Array>
    #PlistExtra:                <string>pcd</string>
    #PlistExtra:            </Array>
    '#PlistExtra:            <key>Public.mime-Type</key>
    '#PlistExtra:            <string>text/plain</string>
    #PlistExtra:        </dict>
    #PlistExtra:    </dict>
    #PlistExtra:</Array>

    #PlistExtra:<key>CFBundleDocumentTypes</key>
    #PlistExtra:<array>
    #PlistExtra:    <dict>
    #PlistExtra:        <key>CFBundleTypeName</key>
    #PlistExtra:            <string>My file type</string>
    #PlistExtra:        <key>LSHandlerRank</key>
    #PlistExtra:            <string>Alternate</string>
    #PlistExtra:        <key>LSItemContentTypes</key>
    #PlistExtra:            <array>
    #PlistExtra:                <string>Public.pcd</string>
    #PlistExtra:            </array>
    #PlistExtra:    </dict>
    #PlistExtra:</array>

What could this be? It works fine if I just use the standard TXT files without the declaration.
Looks like this error is due to your package name in the project, are you using a project package name that matches the identifier you created with your certificate and provision profile?

Did you follow this tutorial.

Walter
 
Upvote 0

Nickelgrass

Active Member
Licensed User
Longtime User
Looks like this error is due to your package name in the project, are you using a project package name that matches the identifier you created with your certificate and provision profile?

Did you follow this tutorial.

Walter
Thanks for the reply. Yes I think I did follow that. Will check it though. The strange thing is that the error only happens if I add the definition for the file extension.
 
Upvote 0
Top