Can xcodebuild manage automatic signing?

后端 未结 9 1822
青春惊慌失措
青春惊慌失措 2021-01-31 15:41

SUMMARY:

If you open a project in Xcode 8 with \"Automatically manage signing\" enabled and a new bundle ID, it will automatically create and download a

9条回答
  •  情书的邮戳
    2021-01-31 15:57

    Notice: This answer assumes that bundle ID and provisioning profiles are created manually. Only build process can be automated using this method.

    Yes that is possible even without using third party tools. you should be comfortable using script file or a make file. I'm using 2 lines of code in a makefile on Mac Mini at work. And that gives us either ad-hoc or appstore version ready for upload according to our configuration.

    1. make sure your project has enabled automatic configuration.
    2. make sure on your remote mac that all singing certificates and provisioning are downloaded. for this case, I always, for the first building, open Xcode and build & export on my remote machine. If that works then nothing is missing. But make sure that you always allow access to the singing certificate. Xcode also asks this for the first the build. Otherwise a popup will show up on your remote server and waits till someone allows access to the signing certificate.
    3. you need a plist file:
    
    
    
      
      teamID  
      MY_TEAM_ID_XXYY //put your iPhone distribution team ID. in my case developer team ID is different than my distribution team ID. just wondering.
      method  
      app-store // for appstore upload or use ad-hoc for ad-hoc  
      uploadSymbols  
        
      uploadBitcode  
        
      
    
    

    You should save plist configuration somewhere accessible, e.g., as options.plist just a reminder: make sure that you have your ad-hoc/distribution provisioning profile on your remote Mac.

    1. xcodebuild will create an archive then we can export .app. In your make file or script file use these lines:

    4.1. First we create the archive file.

    xcodebuild archive -derivedDataPath build/ -project myProject.xcodeproj -scheme myScheme -archivePath build/ios/myProject.xcarchive
    

    derivedDataPath parameter is just a folder that can be deleted later after building the app. you know how much junk is produced in derived data. project name is your project name, and scheme name is right after play|stop button in Xcode. You must choose an archive name and path for the next step.

    4.2 After your archive has been built successfully, use this code to create the app:

    xcodebuild -exportArchive -archivePath build/ios/myProject.xcarchive -exportPath build/ios/ -exportOptionsPlist build/ios/options.plist
    

    Here you use the archive name and path that was used in previous step. exportOptionsPlist needs to know the path and name for your plist configuration that we created in step 3.

    And that's it! You can run these commands in a terminal window it will build your app as well. You can put these 2 line in a script file / makefile and use variables for project name, path and options.plist, Then you can use that to build all of your apps.

    PS: If anything is unclear please let me know and I will add more explanation.

提交回复
热议问题