iOS Question Is this a mistake in "iOS Tutorial: Open external files with your app" ?

Andris

Active Member
Licensed User
Longtime User
There's a line in iOS Tutorial: Open external files with your app that seems like it has an error, even though it's been there quite a while. The PListExtra declaration lines are given as follows:
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array><dict><key>CFBundleTypeIconFiles</key><array/>
#PlistExtra: <key>CFBundleTypeName</key><string>CSV File</string>
#PlistExtra:<key>LSHandlerRank</key><string>Alternate</string>
#PlistExtra:<key>LSItemContentTypes</key><array>
#PlistExtra:<string>public.comma-separated-values-text</string>
#PlistExtra:</array></dict></array>
At the end of Line 2, isn't <array/> an incorrect tag, and shouldn't it be totally removed? Maybe it has no effect on the HTML parsing, but if incorrect, it shouldn't be there. CFBundleTypeIconFiles could be followed by an array of strings defining icons, but if the array is empty, as probably intended in the sample code, it seems that the lines should look like this instead:
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array><dict><key>CFBundleTypeIconFiles</key>
#PlistExtra: <key>CFBundleTypeName</key><string>CSV File</string>
#PlistExtra:<key>LSHandlerRank</key><string>Alternate</string>
#PlistExtra:<key>LSItemContentTypes</key><array>
#PlistExtra:<string>public.comma-separated-values-text</string>
#PlistExtra:</array></dict></array>
 
Solution
You are correct. I will remove it.
Just for clarity, this is the code that's needed if "<array/>" is removed:
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array><dict>
#PlistExtra: <key>CFBundleTypeName</key><string>CSV File</string>
#PlistExtra:<key>LSHandlerRank</key><string>Alternate</string>
#PlistExtra:<key>LSItemContentTypes</key><array>
#PlistExtra:<string>public.comma-separated-values-text</string>
#PlistExtra:</array></dict></array>
And to be more understandable in order to modify/add different keys,
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array>
#PlistExtra:    <dict>
#PlistExtra:        <key>CFBundleTypeName</key>
#PlistExtra:            <string>CSV File</string>
#PlistExtra...

Andris

Active Member
Licensed User
Longtime User
You are correct. I will remove it.
However, I noticed that without "<array/>," it doesn't compile on the hosted builder. Removing line 2 completely, it does -- probably because CFBundleTypeIconFiles requires a string of file names. I guess "<array/>" has the positive effect of negating the line ... ;)
 
Last edited:
Upvote 0

Andris

Active Member
Licensed User
Longtime User
You are correct. I will remove it.
Just for clarity, this is the code that's needed if "<array/>" is removed:
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array><dict>
#PlistExtra: <key>CFBundleTypeName</key><string>CSV File</string>
#PlistExtra:<key>LSHandlerRank</key><string>Alternate</string>
#PlistExtra:<key>LSItemContentTypes</key><array>
#PlistExtra:<string>public.comma-separated-values-text</string>
#PlistExtra:</array></dict></array>
And to be more understandable in order to modify/add different keys,
B4X:
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array>
#PlistExtra:    <dict>
#PlistExtra:        <key>CFBundleTypeName</key>
#PlistExtra:            <string>CSV File</string>
#PlistExtra:        <key>LSHandlerRank</key>
#PlistExtra:            <string>Alternate</string>
#PlistExtra:        <key>LSItemContentTypes</key>
#PlistExtra:            <array>
#PlistExtra:                <string>public.comma-separated-values-text</string>
#PlistExtra:            </array>
#PlistExtra:    </dict>
#PlistExtra:</array>
 
Upvote 0
Solution
Top