Aren’t you excited to finally upgrade Xcode9? Is not upload Fir found error heart crashed. Is looking for a solution all over the street.

Fir automatically uploads scripts

Automatic upload script, save to the project directory, use sh *. Sh -u to upload, in which the FIR token and project name need to be modified, the rest of the error will be modified. See below for details:

#/bin/sh
#coding utf-8
# Upload module requires FIR.im CLI
Gem install FIR -cli
# token for http://fir.im/user/info

# Quiet mode, no extra log output
quiet=1

while getopts "huv" arg The colon after the # option indicates that the option requires arguments
do
    case $arg in
         t)
            echo "t's arg:$OPTARG" The parameter is stored in $OPTARG
            ;;
         u)
            upload=1
            ;;
         v)
            quiet=0
            ;;

         h)
            echo Commands:
            echo " make -u #build ipa and upload fir.im";; ?).What is the arg when there is an unknown option?
        echo "unkonw argument"
    ;;
    esac
done

token="Need to be replaced"  # token for http://fir.im/user/info

echo '--------------start----------------'
echo '>> clean... '
proj=$(cd $(dirname The ${0});pwd-p) xcodebuild clean 1>/dev/null project="$proj/build/$project.ipa"
rm $product

echo '>> build... '
if [[ $quiet == 1 ]]
then
    xcodebuild -workspace "$project.xcworkspace" -scheme "$project" archive -archivePath $proj/build/$project.xcarchive -configuration Ad-hoc -sdk iphoneos >/dev/null
else
    xcodebuild -workspace "$project.xcworkspace" -scheme "$project" archive -archivePath $proj/build/$project.xcarchive -configuration Ad-hoc -sdk iphoneos
fi

echo '>> create ipa... '

xcodebuild -exportArchive -archivePath $proj/build/$project.xcarchive -exportOptionsPlist exportOptions.plist -exportPath "$proj/build"

#copy dsym to xcarchives
echo '>> archive dsym... '
if [[ -d $proj/build/$project.xcarchive ]]
then
    filename=$(date "+%Y%m%d%H%M.%S")
    mkdir -p "$proj/build/archives"
    cp -r $proj/build/$project.xcarchive/ "$proj/build/archives/$filename.xcarchive"
    cp "$product" "$proj/build/archives/$filename.xcarchive"
fi

if [[ $upload== 1]] && [[-f "$product" ]]
then
    fir l $token
    fir p "$product"
    clear
    fir i "$product"
else
    open "$proj/build"
fi

Copy the code

An error

Using the Fir automatic upload script before, I suddenly found that there was an error, but it was clearly good before upgrading Xcode 9, So I had to find a way to solve it. Take a look at the error log:

The 2017-09-20 14:22:07. 140 xcodebuild [31386-364151] (MT) IDEDistribution: Step failed: < IDEDistributionSigningAssetsStep: 0x7f8cdcc95b90>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0"Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
    "Error Domain=IDEProvisioningErrorDomain Code=9 \"\"name.app\" requires a provisioning profile with the Push Notifications feature.\" UserInfo={NSLocalizedDescription=\"name.app\" requires a provisioning profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}"
)}
error: exportArchive: "name.app" requires a provisioning profile with the Push Notifications feature.

Error Domain=IDEProvisioningErrorDomain Code=9 ""name.app" requires a provisioning profile with the Push Notifications feature." UserInfo={NSLocalizedDescription="name.app" requires a provisioning profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}

** EXPORT FAILED **
Copy the code

The first reaction is to re-create the Push certificate, yes. That’s what I thought, and then I realized that it didn’t work.

Generate *.app to *.ipa

When automated scripts find that they don’t work, the way I think about it is that it has to be done manually. Select the appropriate Build Configuration for Building *.app.

This is a pit. You’ll notice how you can’t find the “apps” option. The latest version of iTunes has stripped the App Store of its functionality. There are no more app options. For most of the day, I found None is None.

Archive

The last option is to use Xcode Archive to export the IPA package. This is similar to how you upload the App Store. The resulting files are:

Upload the generated *. Ipa file to Fir, and the work is complete.

Automatically upload

First of all, there are three more files. That’s what Xcode has changed. The main change is the addition of the ExportOptions file, which should be related to the error reported earlier. Then I found the method of automatic upload, put the ExportOptions file into the project, my directory is

Analysis of the

Found that in Xcode 9, the change to exportoptions. plist,

after

ProvisioningProfiles, signingCertificate, and signingStyle are included. An error was reported for the automated script that the provisioningProfiles attribute was missing. You can add all the attributes manually by clicking on the image, or you can export them to the exportOptions.plist file using Xcode.

At the end

Every time you upgrade your system or Xcode there is a day of waiting and fixing problems. Today iOS11 also encountered a crash because of the use of WebViewJavascriptBridge third-party library, is busy for a while, solution:

WebViewJavascriptBridgeBase *base = [[WebViewJavascriptBridgeBase alloc] init];
        if ([base isWebViewJavascriptBridgeURL:navigationAction.request.URL]) {
            DLog(@"isWebViewJavascriptBridgeURL is YES.");
            return;
        }
decisionHandler(WKNavigationActionPolicyAllow);
Copy the code

// END has never stopped learning, but has never been fully learned and never satisfied.