Recently in the study of automatic generation of apps, use Python to write programs to replace icons, names, etc., and then create new apps.
Usually packaged with Xcodebuild and Xcrun two commands, Xcodebuild is responsible for compiling, Xcrun is responsible for the app into IPA.
The following are common steps:
1. Clean-up Works
/usr/bin/xcodebuild-target TargetName Clean
2. Compiling project
/usr/bin/xcodebuild-target TargetName
3. Packing
/USR/BIN/XCRUN-SDK Iphoneos packageapplication-v Path/to/xxx.app-o Xxx.ipa
If it is a package with a signature, the above two commands need to add some parameters.
xcodebuild-target targetName code_sign_identity= "IPhone distribution:xxxxxx"
xcrun-sdk iphoneos packageapplication-v Source app path-o Output IPA path--sign "IPhone distribution:xxxxxx"
Automatic Packaging steps:
1, first use XOCDE manually compiled good one app, assuming that the Myapp.app
2. Import the certificate file into the key chain of the Mac
Create key Chains
Security create-keychain-p MyApp Myapp.keychain
Unlock, or the bounce box waits for the password to be entered
Security unlock-keychain-p MyApp Myapp.keychain
Import Certificate
Security Import/opt/myapp.p12-k myapp.keychain-p mypassword-t/usr/bin/codesign
3, to Myapp.app as a template, copy a backup, and then to replace the various resources, such as the replacement of the application of image files, etc.
4, replace the corresponding *.mobileprovision file to the Myapp.app directory
5, delete the signature information under Myapp.app _codesignature
6, modify Info.plist Bundle indentifier and *.mobileprovision consistent
7, modify myapp.xcent application-identifiervalue value for the corresponding certificate name, you can use a xcent as a template, Note If there is no aps-environment keyword, the calling out of the IPA package will not have APNs module , in the following format:
<? 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>application-identifier</ key >
<string>Z4LR7CBRUD.com.yesun.vic </ String>
<key>aps-environment</key >
<string>production</string>
<key>get-task-allow</key >
<false/>
</ Dict >
</ plist >
8. Re-signed Codesign
/usr/bin/codesign--force--sign 9c8b212f6a2c2382847b104e387a01b246d4ce42--resource-rules=myapp.app/ Resourcerules.plist--entitlements myapp.xcent Mkey3g.app
9. Generate IPA Package
/USR/BIN/XCRUN-SDK Iphoneos packageapplication-v myapp.app-o myapp.ipa--sign 9c8b212f6a2c2382847b104e387a01b246d4ce --embed myapp.app/embed.mobileprovision
10. Delete Key Chain
Security Delete-keychain Myapp.keychain
The package steps with Xcodebuild compilation are as follows:
- Import Key Chain
- On the project clean
- Modify Info Info
- Modify project information
- Xcodebuild
- Replace various resource files
- Modify Xcent
- Re-signing Codesign
- Xcrun Play IPA
- Delete Key Chain
iOS projects are automatically released via Xcodebuild and Xcrun