一、構(gòu)建可執(zhí)行文件
1.代碼編譯過程
xcrun -sdk iphoneos clang -arch arm64 -mios-version-min=13.0 -F UIKit -fobjc-arc -c main.m -o main.o
xcrun -sdk iphoneos clang -arch arm64 -mios-version-min=13.0 -F UIKit -fobjc-arc -c SceneDelegate.m -o SceneDelegate.o
xcrun -sdk iphoneos clang -arch arm64 -mios-version-min=13.0 -F UIKit -fobjc-arc -c AppDelegate.m -o AppDelegate.o
xcrun -sdk iphoneos clang -arch arm64 -mios-version-min=13.0 -F UIKit -fobjc-arc -c ViewController.m -o ViewController.o
2.鏈接(link)
xcrun -sdk iphoneos clang main.o SceneDelegate.o AppDelegate.o ViewController.o -arch arm64 -mios-version-min=13.0 -fobjc-arc -framework UIKit -o TestProject
此時得到的TestProject 就是 可執(zhí)行文件
二、storyboard 或是xib文件的編譯
ibtool LaunchScreen.storyboard --compile LaunchScreen.storyboardc
ibtool Main.storyboard --compile Main.storyboardc
三、Images.xcassets等xcassets文件編譯
actool Images.xcassets --compile AssetsOut --platform iphoneos --minimum-deployment-target 13.0
四、簽名
創(chuàng)建一個后綴是.app的文件夾,并將以上Assets.car、TestProject、AppIcon60x60@2x.png、AppIcon76x76@2x~ipad.png、embedded.mobileprovision、Info.plist放入其中,而LaunchScreen.storyboardc和Main.storyboardc要放在新創(chuàng)建的Base.lproj中,其中embedded.mobileprovision(描述文件)開發(fā)者中心下載、Info.plist可以在項目中獲得。
codesign -fs '證書名字' --no-strict --entitlements Entitlements.plist TestProject.app
此時在TestProject.app下會得到一個_CodeSignature/CodeResources
重點說下Entitlements.plist的來源
將得到的embedded.mobileprovision使用
security cms -D -i embedded.mobileprovision
查看并將Entitlements部分copy到一個空的plist中