jamesmontemagno / vsts-mobile-tasks

VSTS Tasks for Mobile!
MIT License
79 stars 22 forks source link

Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/Info.plist #24

Closed KP1980 closed 5 years ago

KP1980 commented 5 years ago

I am getting below error while using "iOS Bundle Version Numbers" task.

"Error Reading File: /Users/vsts/agent/2.154.3/work/1/s///***.iOS/Info.plist"

Below is the complete "Print File" output from the task:

##[section]Starting: Bump iOS Versions in ***/***/***.iOS/Info.plist
==============================================================================
Task         : iOS Bundle Version Numbers
Description  : Bump the version of your iOS info.plist file at build time.
Version      : 1.0.0
Author       : James Montemagno
Help         : 
==============================================================================
Found non-key inside <dict> at line 68
Found non-key inside <dict> at line 68
Found non-key inside <dict> at line 68
 (i) Provided Info.plist path:/Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Original 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>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</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>9.0</string>
    <key>CFBundleDisplayName</key>
    <string>***</string>
    <key>CFBundleName</key>
    <string>***</string>
    <key>CFBundleIdentifier</key>
    <string>com.***.ios</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.22</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
Found non-key inside <dict> at line 68
    <string>LaunchScreen</string>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/AppIcon.appiconset</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Location access is required</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Location access is required</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Location access is required</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLTypes</key>
            <string>***</string>
            <key>CFBundleURLName</key>
            <string>***</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>***</string>
            </array>
        </dict>
    </array>
    <key>NSCalendarsUsageDescription</key>
    <string>$(PRODUCT_NAME) calendar events</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>***</key>
        <true/>
    </dict>
    <dict>
        <key>ITSAppUsesNonExemptEncryption</key>
        <false/>
    </dict>
</dict>
</plist>

 (i) Version Name (shortcode): 1.0
 (i) Using Custom Defined Version Code and adjusting for offset if needed.
 (i) Build number: 1.23
[command]/usr/libexec/PlistBuddy -c Print CFBundleVersion /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
[command]/usr/libexec/PlistBuddy -c Set :CFBundleVersion 1.23 /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
[command]/usr/libexec/PlistBuddy -c Print CFBundleShortVersionString /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
[command]/usr/libexec/PlistBuddy -c Set :CFBundleShortVersionString 1.0 /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Final 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>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</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>9.0</string>
    <key>CFBundleDisplayName</key>
    <string>***</string>
    <key>CFBundleName</key>
    <string>***</string>
    <key>CFBundleIdentifier</key>
    <string>com.***.ios</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.22</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/AppIcon.appiconset</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Location access is required</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Location access is required</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Location access is required</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLTypes</key>
            <string>***</string>
            <key>CFBundleURLName</key>
            <string>****</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>***</string>
            </array>
        </dict>
    </array>
    <key>NSCalendarsUsageDescription</key>
    <string>$(PRODUCT_NAME) calendar events</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>***</key>
        <true/>
    </dict>
    <dict>
        <key>ITSAppUsesNonExemptEncryption</key>
        <false/>
    </dict>
</dict>
</plist>

Task done!

[section]Finishing: Bump iOS Versions in //***.iOS/Info.plist

As you would find the incremental build number is not updated in the Final info.PList file.

jamesmontemagno commented 5 years ago

Try to run this locally on your mac.

/usr/libexec/PlistBuddy -c Set :CFBundleVersion 1.23 /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist
Error Reading File: /Users/vsts/agent/2.154.3/work/1/s/***/***/***.iOS/Info.plist

It seems like it is an issue with your info.plist perhaps.

KP1980 commented 5 years ago

I was able to set CFBundleVersion in Info.plist using PlistBuddy on my Mac locally. It does not seem to be an issue with info.plist file.

P.S. The issue happens when running the task on "Hosted macOS" agent pool.

jamesmontemagno commented 5 years ago

Hmmm I don't have this issue at all: https://dev.azure.com/jamesmontemagno/HelloDevOps/_build/results?buildId=925

image

jamesmontemagno commented 5 years ago

You can also try to run this shell script: https://github.com/jamesmontemagno/vsts-mobile-tasks/blob/master/tasks/iOSBundleIdentifier/task.sh

This is what is executes.

KP1980 commented 5 years ago

You were right, it was an issue with info.plist file.

I changed the following block

<dict>
    <key>ITSAppUsesNonExemptEncryption</key>
    <false/>
</dict>

to

    <key>ITSAppUsesNonExemptEncryption</key>
<false/>

in the info.plist file.

The info.plist file I was able to update using PlistBuddy on my local (as mentioned in my earlier response) had diffrent version than what was being used in build in Azure DevOps. My local version did not have this block so I was able to successfully update it using PlistBuddy.

Thank you for your prompt response during the weekend. I appreciate it.

Have a good rest of the weekend. Thank you again.