赞
踩
一、在OsX系统上安装Jenkins
二、打开终端,安装XCode的命令行工具
xcode-select --install
三、添加xcodeproj和fir-cli工具
gem install xcodeproj
gem install fir-cli
四、在~目录中新建一个Unity.rb文件,内容是需要对导出的iOS工程进行修改的脚本,其中
releaseTarget.frameworks_build_phase.add_file_reference 为添加链接库,内容如下:
- require 'xcodeproj'
- project = Xcodeproj::Project.open("Unity-iPhone.xcodeproj");
- targets = project.native_targets();
- releaseTarget = targets[0];
- usrLibPath="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/";
- libs = ["libstdc++.tbd", "libstdc++.6.0.9.tbd", "libz.1.2.5.tbd"];
- libs.each do |name|
- r = project.frameworks_group.new_file(usrLibPath+name, :sdk_root);
- releaseTarget.frameworks_build_phase.add_file_reference(r, true);
- end
- sysPath="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/";
- syslibs=["Security.framework",
- "AVFoundation.framework",
- "SystemConfiguration.framework",
- "AudioToolbox.framework",
- "CoreLocation.framework",
- "AddressBook.framework",
- "CoreTelephony.framework"];
- syslibs.each do |name|
- project.frameworks_group.new_file(sysPath+name, :sdk_root);
- end
- project.save();
五、在Jenkins中添加Unity3d的构建
currtime=`date "+%Y%m%d_%H.%M.%S"`
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath /User/myproj -logFile /tmp/1.log -executeMethod MyBuild.BuildIOS ${currtime}
如果MyBuild.BuildIOS构建成功,则把iOS工程导出到当前一个新的目录${currtime}
六、运行 ruby unity.rb, 对XCode工程进行修改
七、运行XCode命令行工具Archive及Export ipa
xcodebuild clean -project ./Unity-iPhone.xcodeproj -configuration Release -alltargets
xcodebuild archive -project ./Unity-iPhone.xcodeproj -scheme Unity-iPhone -archivePath ./build_output/Unity-iPhone.xcarchive
xcodebuild -exportArchive -archivePath ./build_output/Unity-iPhone.xcarchive -exportPath ./build_output/Unity-iPhone -exportFormat ipa -exportProvisioningProfile "XCAd Hoc: com.my.game"
八、上传fir.im
fir login --token=XXXXXXXX
fir publish ./Unity-iPhone.ipa
其中XXXX为fir.im API Token
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。