0

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>
kantawit
  • 101
  • 1
  • 1
  • 6

2 Answers2

0

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.

Prasad G
  • 6,702
  • 7
  • 42
  • 65
  • Thank you. and How about if the the name of image, I did't know before. So that why I would like to add all file by automatically – kantawit Jan 03 '13 at 07:17
0

Maintain count of images u added say int count in as class memember.

In viewDidLoad

 count = 0;

Now adding (Saving) Images increase count. Each time new count name image file will be saved which can be easily managed:

 NSString *filepath1 = [NSString stringWithFormat:@"%@/Image%03d",documentDirPath,count];
 [imgData writeToFile:filepath1 atomically:YES];
 count ++;
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132