Search code examples
iosxcodeimportruntimeresourcebundle

Add all files in Document on iphone into copy bundle resource at the runtime


I would like to add all JPEG files in Document on iphone into copy bundle resource at the runtime. Is it possible? How? My plist is FrameMarkers-Info.plist. Where can I put your code. When I add it, it tell me error.

<?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>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundleDocumentTypes</key>
    <array/>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIconFile</key>
    <string>icon_vuforia_57x57.png</string>
    <key>CFBundleIconFiles</key>
    <array>
        <string>icon_vuforia_57x57.png</string>
        <string>icon_vuforia_114x114.png</string>
        <string>icon_vuforia_72x72.png</string>
    </array>
    <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon_vuforia_57x57.png</string>
                <string>icon_vuforia_114x114.png</string>
                <string>icon_vuforia_72x72.png</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
    </dict>
    <key>CFBundleIdentifier</key>
    <string>th.ac.kmitl.ce.nwlab.${PRODUCT_NAME:rfc1034identifier}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleURLTypes</key>
    <array/>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UTExportedTypeDeclarations</key>
    <array/>
    <key>UTImportedTypeDeclarations</key>
    <array/>
</dict>

</plist>

Solution

  • Yes. You can save following data in .plist file.

    <?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>name</key>
            <string>images.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images1.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images2.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images3.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images4.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images5.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images6.jpg</string>
        </dict>
        <dict>
            <key>name</key>
            <string>images7.jpg</string>
        </dict>
    </array>
    </plist>
    

    I think it will be helpful to you.