<span id="Label3"> </p> Recently we have received a new demand, need to play similar xx001-xx100 a total of 100 such IPA channel package, do not need to SIGN. (this batch of IPA package follow-up will be signed with Enterprise certificate, will not affect appstore) These packages all the functions, the content is the same, the difference is that different packages in the statistics, connect our server will provide a different string label. If we follow the usual packaging, we need to constantly revise the values in the project and then pack them up ... How can you endure this kind of work without technical content? After a simple thought, we can think of the use of shell scripts to achieve bulk packaging, channel information can be stored in the application of Info.plist Inside. Batch processing ideas: 1. By changing a setting or variable, a value in the Info.plist in the project is changed 2. Use the Xcodebuild command to package processing segmentation in fact, there are several practices: 1. The advantage of using multiple target is that it can be more deeply customized information disadvantage is that for our simple needs, the operation is slightly cumbersome, Higher Cost. The script is similar to the following 2, except that the variable is target. 2. Use multiple buildsetting different build active architecture to set different user-defined values First edition scripts are provided by my colleagues, this is the way A little bit simpler than the one in the above ideas and steps are as follows: 1. In the build settings of xcode, multiple build active architecture are generated by copy release, named 2 by channel name, Respectively. Under the user-defined property, add a key named channel, and set different channel values for different builds 3. Info.plist the Channel key is added, the value refers to the settings under user-defined ${channel} (the script is not posted here because the scheme is not Perfect) when I see this scenario, I'm still not satisfied, Because of the need to change the project configuration and other relevant information, is still very troublesome. for us, The package is actually only info.plist in a preset value is not the same, actually can not need so many target or so many buildsetting, just need toWhen packaging, use a script to change the corresponding key value in the Info.plist. Find Data find, command Modify Plist value already has built-in tool plistbuddy, but this tool uses its absolute path to refer to, the path is/usr/libexec/plistbuddy, the Tool's more function is interested can search by oneself. After adjusted, the script is: channels= (channel 1 Channel 2 channel 3) for i in ${channels[@]} do xcodebuild-project./your work Ride. Xcodeproj-scheme your scheme name-configuration Release archive-archivepath./$i /usr/libexec/plistbuddy-c "set:chan Nel "$i"./$i .xcarchive/products/applications/*.app/info.plist rm-rf./$i .ipa xcodebuild-exportarchive -exportformat ipa-archivepath/archive.xcarchive-exportpath./$i .ipa-exportwithoriginalsigningidentity rm- Rf./$i .xcarchive done[/code] well, finished with, can be packaged in bulk packaging no problem, ah, but it seems to take time to ...... back to our analysis of the packaging process: 1. Use the Xcodebuild command to generate xcarchive files based on the project 2. Use the Xcarchive file to export the ipa, which can be signed for a one-time packaging process, During the generation of the xx.xcarchive file, this file has not yet performed any signature and other operations, in fact, we can directly modify the Xcarchive package in the corresponding app files within the plist, and then exported to ipa, so that you can share a xcarchive file, save n Multiple packaging out The time of the File. Well adjust to get our final version: xcodebUild-project./your Project. Xcodeproj-scheme your scheme name-configuration Release archive-archivepath ./archive channels= (channel 1 Channel 2 channel 3) For i in ${channels[@]} do /usr/libexec/plistbuddy-c "set:channel" "$i"./archive.xcarchive/products/appli cations/*.app/info.plist rm-rf./$i .ipa Xcodebuild-exportarchive-exportformat ipa-archivepath./archive . xcarchive-exportpath./$i .ipa-exportwithoriginalsigningidentity done rm-rf./archive.xcarchive[/code] Be aware of 1. In the Project's info.plist file, a channel key is set in advance, and the value is written on the default channel. 2. The corresponding certificate in the project is still to be configured, or the package may fail 3. In this article, the IPA is unsigned, need to sign the words of their own search, relatively simple save this script as a archive file, lost in the project directory, use the way: open terminal, execute two lines of command CD your project directory [/code] ./archive[/code] well, after finishing, so you're in the works, use nsstring* channel = [[[nsbundle mainbundle] infodictionary] obje ctforkey:@ "Channel"]; [/code] get is the channel Information.<p><p> iOS uses scripts to bulk channel packages </p> </p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service