Appbuilder: get info.plist key value

4 posts, 0 answers
  1. Nathaniel
    Nathaniel avatar
    1 posts
    Member since:
    Mar 2015

    Posted 15 Jan 2016 Link to this post

    We are trying to get a custom key value set in the info.plist (userid) from mobileiron.  We are able to set a value, however we cannot get the value with javascript or cordova.  Is there a way to get a custom key value within javascript or cordova?  

     Any ideas/help would be greatly appreciated.

     

  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    597 posts

    Posted 20 Jan 2016 Link to this post

    Hello,

    I am summarizing below some information provided in a private support ticket of yours.

    Usually, you should be able to read from it the same way or with the same means used for writing.

    Dynamic key value pairs can be added and read via the NSUserDefaults class. The same class could be used to read from the property list file (.plist).

    You can use a plugin to write or access keys from the NSUserDefaults storage. This plugin and this one too advertise a similar capability. Note that you have to know the key name in order to access it.

    I hope that this helps.

    Regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. JAGS
    JAGS avatar
    1 posts
    Member since:
    Apr 2017

    Posted 27 Apr Link to this post

    Hello there!,

    Been trying to find a post in the forum about the build being rejected for not having NSPhotoLibraryUsageDescription in info.plist file. However there is a weird situation here with us. We opened info.plist file of our app and added the following keys and strings
    <key>NSCameraUsageDescription</key>
    <string>JAGS india requires camera usage for the user to post custom orders</string>
    <key>NSContactsUsageDescription</key>
    <string>JAGS India requires Contact usage for the user to be able to share using his contacts</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Jags India needs notification when in use to notify users for updates</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>JAGS India needs Microphone to user to send voice feedbacks</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>JAGS India needs Photo library for the user to be able to save pictures from the app</string>

     

    yet after uploading the build we got an email from apple stating as under :-

    "Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data."

     

    when we contacted apple support they replied that they found the keys but the string values are empty.....now how on god's earth is that possible?? when we have already added it? Below is our info.plist code for reference (see the bottom few lines). We shall be grateful if you have guide us to solve this problem. Perhaps we have written the code wrong?

     

    <?xml version="1.0" encoding="UTF-8"?>
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
        <string>$BundleExecutable$</string>
        <key>CFBundleIconFile</key>
        <string>icon.png</string>
        <key>CFBundleIcons</key>
        <dict>
            <key>CFBundlePrimaryIcon</key>
            <dict>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>icon@2x.png</string>
                    <string>icon.png</string>
                    <string>Icon-Small.png</string>
                    <string>Icon-Small@2x.png</string>
                    <string>icon-72.png</string>
                    <string>icon-72@2x.png</string>
                    <string>Icon-Small-50.png</string>
                    <string>Icon-Small-50@2x.png</string>
                    <string>icon-40.png</string>
                    <string>icon-40@2x.png</string>
                    <string>icon-60.png</string>
                    <string>icon-60@2x.png</string>
                    <string>icon-76.png</string>
                    <string>icon-76@2x.png</string>
                    <string>icon-83.5@2x.png</string>
                </array>
                <key>UIPrerenderedIcon</key>
                <true/>
            </dict>
        </dict>
        
        <key>CFBundleIdentifier</key>
        <string>$AppIdentifier$</string>
        <key>CFBundleName</key>
        <string>$ProjectName$</string>
        <key>CFBundleDisplayName</key>
        <string>$DisplayName$</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>$GeneratedBuildVersionNumber$</string>
        <key>CFBundleShortVersionString</key>
        <string>$BundleVersion$</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UILaunchImages</key>
        <array>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{320, 480}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{320, 480}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-568h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{320, 568}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-568h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{320, 568}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-667h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{375, 667}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-667h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{375, 667}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-736h</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{414, 736}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Landscape-736h</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{414, 736}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Portrait</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{768, 1024}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Landscape</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{768, 1024}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Portrait-1366</string>
                <key>UILaunchImageOrientation</key>
                <string>Portrait</string>
                <key>UILaunchImageSize</key>
                <string>{1024, 1366}</string>
            </dict>
            <dict>
                <key>UILaunchImageMinimumOSVersion</key>
                <string>8.0</string>
                <key>UILaunchImageName</key>
                <string>Default-Landscape-1366</string>
                <key>UILaunchImageOrientation</key>
                <string>Landscape</string>
                <key>UILaunchImageSize</key>
                <string>{1024, 1366}</string>
            </dict>
        </array>
        
        <key>NSAppTransportSecurity</key>
        <dict>
          <!--Allow all connections -->
          <key>NSAllowsArbitraryLoads</key>
              <true/>
        </dict>
        <!-- Opt out of "Slide Over and Split View" -->
        <key>UIRequiresFullScreen</key>
        <true/>
        <key>NSCameraUsageDescription</key>
    <string>JAGS india requires camera usage for the user to post custom orders</string>
    <key>NSContactsUsageDescription</key>
    <string>JAGS India requires Contact usage for the user to be able to share using his contacts</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Jags India needs notification when in use to notify users for updates</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>JAGS India needs Microphone to user to send voice feedbacks</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>JAGS India needs Photo library for the user to be able to save pictures from the app</string>
    </dict>

    </plist>

  4. Anton Dobrev
    Admin
    Anton Dobrev avatar
    597 posts

    Posted 02 May Link to this post

    @JAGS,

    My suggestion here, based in the experience we had with such issues in the past months would be to upgrade your project to target the latest Cordova 6.4 set in your Telerik Platform app. The procedure for this is explained here

    Further, you may need to provide this usage description for each plugin which you app is using and requires access to the camera or photo library. For example, from the Core plugins, the Camera and Capture plugins require such descriptions, from the Verified plugins - the BarcodeScanner. If you provide Usage Description only for one of the plugins, the value in the Info.plist file will remain blank and you will be unable to publish.

    To summarize, a possible fix to the issue you have come across would be to:

    1. Update Cordova to 6.4 from your project's Properties > General tab
    2. Make sure to have description for each Core plugin that you are using - the recommended way of adding such descriptions is via plugin variables. More about this can be found here.
    3. Delete all additionally added keys in your info.plist file
    4. Publish the newly built IPA in the App Store again

    I hope this helps. 

    Regards,
    Anton Dobrev
    Telerik by Progress
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top