Remove a dict entry from Info.plist with plutil/PlistBuddy - ios

I have the following Info.plist (UTF8) 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">
<dict>
<key>CFBundleDisplayName</key>
<string>yaka</string>
<key>CFBundleIdentifier</key>
<string>com.whetever.youwant</string>
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
<key>CFBundleVersion</key>
<string>1.0.5</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>fr</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>MinimumOSVersion</key>
<string>9.3</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleName</key>
<string>yaka</string>
<key>UIAppFonts</key>
<array>
<string>Fonts/Ubuntu-Regular.ttf</string>
<string>Fonts/Ubuntu-Medium.ttf</string>
<string>Fonts/Ubuntu-Light.ttf</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Nous utilisons la caméra pour les videoconférences</string>
<key>NSMicrophoneUsageDescription</key>
<string>Nous utilisons le micro pour les videoconférences</string>
<key>NSBonjourServices</key>
<array>
    <string>_reveal._tcp</string>
</array>
</dict>
</plist>
I'm trying to Remove the NSBonjourServices entry located at the end of the file using plutil or PlistBuddy but it fails miserably:
/usr/libexec/PlistBuddy -c 'Delete :NSBonjourServices' Info.plist
Encountered unexpected character \u00c2 on line 80 while looking for open tag
Error Reading File: Info.plist
plutil -remove NSBonjourServices Info.plist
Info.plist: Property List error: Encountered unexpected character  on line 80 while looking for open tag / JSON error: JSON text did not start with array or object and option to allow fragments not set.
Line 80 is this one:
    <string>_reveal._tcp</string>

Your Info.plist has an illegal character in it. You might be able to fix by deleting and retyping that one line, or the whole NSBonjourServices array.

Related

Nativescript - The application's Info.plist does not contain CFBundleVersion

Describe the bug
When I build and run my apps on tns cli or directly in xcode, i have the error:
Unable to apply changes on device: 2727B173-9A43-43B3-A51E-4D3CAC1E3EF9. Error is: Command xcrun with arguments simctl install 2727B173-9A43-43B3-A51E-4D3CAC1E3EF9 /Users/user189510/Documents/poly3000-nativescript/platforms/ios/build/Debug-iphonesimulator/poly3000nativescript.app failed with exit code 22. Error output:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The application's Info.plist does not contain CFBundleVersion.
The info.plist in App_Resources/IOS seems ok:
<?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>fr</string>
<key>CFBundleDisplayName</key>
<string>YaToYa</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</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.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
<key>UseExternalPushProvider</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</plist>
I have check in Xcode if value was correct (yes), clean simulator, delete cache from xcode, try to restart all the process after deleted all, deleted folder Developer/DerivedData in xcode... but always the issue.
I have try a lot of proposition find on the web without success.
Some people to help me please?
To Reproduce
Prepare the application to run on simulator:
tns clean
tns prepare ios
tns run ios
Expected behavior
Start the application on ios simulator
My bad!!!
I have found the issue, a bad format of the file.
The correct file is
<?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>fr</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</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.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UseExternalPushProvider</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
The question can be close.
Thanks

Ionic IOS import more than one document

If I'm in the Apple Files App and select multiple documents and want to import them into my App it only imports the first document and not all of the selected documents. So when I start the simulator and open the finder I can see in the temp/Name-Inbox folder of the simulator that there is only one file, but I want to have all of them in this folder. Is there a setting I can change to make this possible for example in the Info.plist?
I'm Using Ionic 5 and Cordova 10.
This is my Info.plist:
<!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_US</string>
<key>CFBundleDisplayName</key>
<string>Name</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</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.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string/>
<key>NSMainNibFile~ipad</key>
<string/>
<key>UILaunchStoryboardName</key>
<string>CDVLaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIInterfaceOrientation</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>NSCameraUsageDescription</key>
<string/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires photo library access to function properly.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to function properly.</string>
<key>NSFaceIDUsageDescription</key>
<string/>
<key>UISupportsDocumentBrowser</key>
<false/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<false/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeMIMETypes</key>
<array/>
<key>CFBundleTypeName</key>
<string>Portable Document Format</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
<string>nl</string>
<string>fr</string>
<string>it</string>
<string>pt-BR</string>
</array>
<key>NSCalendarsUsageDescription</key>
<string/>
<key>NSContactsUsageDescription</key>
<string/>
</dict>
</plist>

iOS Invalid code signing Entitlements

I created an app in Xamarin, that I am going to upload to TestFlight, but I am getting an error when trying to upload it.
It says
ERROR ITMS-90045: "Invalid Code Signing Entitlements. Your application bundle's signature contains signing entitlements that are not supported on iOS. Specifically, key 'UIBackgroundModes' in **app-path**' is not supported."
My Info.plist are as shown below
<?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>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>7.1</string>
<key>CFBundleDisplayName</key>
<string>**app-name**</string>
<key>CFBundleIdentifier</key>
<string>**app-path**</string>
<key>CFBundleVersion</key>
<string>10</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon#2x.png</string>
<string>Icon.png</string>
<string>Icon-60#2x.png</string>
</array>
<key>CFBundleShortVersionString</key>
<string>1.6.4</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
<key>BackgroundImage</key>
<string></string>
</dict>
</dict>
<key>UIPrerenderedIcon</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UIAppFonts</key>
<array>
<string>icomoon.ttf</string>
<string>TitilliumWeb-Light.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
</dict>
</plist>
The Entitlements.plist is shown below
<?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>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)**app-path**</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
</dict>
</plist>
What can I have done wrong?
In the example below I have replaced the app-name and app-path with **app-name** and **app-bath**
UIBackgroundModes is not a valid entitlement key - this key should be included in Info.plist instead.
Info.plist key reference:
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html
Entitlements.plist key reference:
https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AboutEntitlements.html
Hope this helps.

Can't edit Info.plist (read/write permission) in XCODE 7

I'm trying to solve the issue mentioned here.
I found a solution: edit my info.plist.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
I tried to edit every way I could think of (Textedit, xml edit, open as source code, etc.). I even tried to do it manually with raw values, but every time I try to save it, it freezes.
Why is this happening, and how can I fix it?
my info Plist
<?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>English</string>
<key>CFBundleDisplayName</key>
<string>MY APP</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon_76x76.png</string>
<string>Icon_152x152.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.myapp.app</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>2.6.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.6.3</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<-- Here I was trying to copy paste -->
</dict>
</plist>
At the end you can add like this.. this resolves you.
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

iOS Changing Bundle Identifier using PlistBuddy not working

I'm trying to change the bundle identifier of my XCode project programmatically.
$ /usr/libexec/PlistBuddy -c "Set :CFBundleIndentifier
com.myIdentifier.appName" MyApp-Info.plist
But I keep getting the error -
Set: Entry, ":CFBundleIndentifier", Does Not Exist
This is how my Info-Plist looks like and it has the entry for CFBundleIndentifier.
<?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>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-120</string>
<string>Icon.png</string>
<string>Icon#2x.png</string>
<string>Icon-iPad.png</string>
<string>Icon-iPad#2x.png</string>
</array>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-152</string>
<string>Icon-76</string>
<string>Icon-120</string>
<string>Icon.png</string>
<string>Icon#2x.png</string>
<string>Icon-iPad.png</string>
<string>Icon-iPad#2x.png</string>
</array>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>com.myOldIdentifier.app</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>3.0.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
<array>
<string>Gotham-Bold.otf</string>
<string>Gotham-BoldItalic.otf</string>
<string>Gotham-Book.otf</string>
<string>Gotham-BookItalic.otf</string>
<string>Gotham-Light.otf</string>
<string>Gotham-LightItalic.otf</string>
<string>Gotham-Medium.otf</string>
<string>Gotham-MediumItalic.otf</string>
</array>
<key>UIApplicationExitsOnSuspend</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>
Maybe I'm using the PlistBuddy wrong. How do I change the Bundle identifier of an XCode project using command line. I need to add it in a script.
You have misspelt the name of the key. It should be CFBundleIdentifier and not CFBundleIndentifier

Resources