引言
- Xcode13建立項目不顯示Products目錄的解決方案
- Xcode13建立的工程恢複從前的Info.plist同步機制的方法
- 自動管理簽名證書時拉取更新裝置描述檔案的方法。
I 顯示Products目錄的解決方案
問題:Xcode13 建立的項目不顯示Products目錄
解決方式: 修改project.pbxproj 檔案的productRefGroup配置資訊
效果:

應用場景:Products目錄的app包用于快速打測試包。
1.1 從Xcodeeproj 打開project.pbxproj
1.2 修改productRefGroup 的值
将mainGroup 對應的值複制給productRefGroup 的值,按command+s儲存project.pbxproj檔案,Xcode将自動重新整理,Products目錄顯示出來了。
1.3 應用場景
通過Products目錄快速定位擷取真機調試包路徑,使用腳本快速打包。
打包腳本核心邏輯:在含有真機包路徑下拷貝.app 到建立的Payload目錄,zip壓縮Payload目錄并根據目前時間來命名為xxx.ipa。
#!/bin/bash
echo "==================(create ipa file...)=================="
# cd `dirname $0`;
rm -rf ./Target.ipa;
rm -rf ./Payload;
mkdir Payload;
APP=$(find . -type d | grep ".app$" | head -n 1)
cp -rf "$APP" ./Payload;
data="`date +%F-%T-%N`"
postName="$data"-".ipa"
zip -r -q "$postName" ./Payload;
rm -rf ./Payload;
open .
# 移動ipa包到特定目錄
mkdir -p ~/Downloads/knPayload
cp -a "$postName" ~/Downloads/knPayload
open ~/Downloads/knPayload
echo "==================(done)=================="
exit;
II 關閉打包合并Info.plist功能
Xcode13之前
Custom iOS Target Properties
面闆和Info.plist的配置資訊會自動同步。
Xcode13建立的工程預設開啟打包合并Info.plist功能,不再使用配置檔案(Info.plist、entitlements),如果需要修改配置,直接在Xcode面闆
target - Info - Custom iOS Target Properties
和
build settings
中設定。
Projects created from several templates no longer require configuration files such as entitlements and Info.plist files. Configure common fields in the target’s Info tab, and build settings in the project editor.![]()
iOS小技能:Xcode13的使用技巧
2.1 設定Info.plist為主配置檔案
由于GUI配置面闆沒有配置檔案plist的靈活,不支援檢視源代碼。是以我們可以在
BuildSetting
将
Generate Info.plist File
設定為NO,來關閉打包合并功能。
關閉打包合并功能,重新開機Xcode使配置生效,
Custom iOS Target Properties
面闆的資訊以
info.plist
的内容為準。
每次修改都要重新開機Xcode,info.plist的資訊才會同步到
info.plist
面闆。
Custom iOS Target Properties
![]()
iOS小技能:Xcode13的使用技巧
2.2 注意事項
注意: 關閉打包合并Info.plist功能 之前記得先手動同步
Custom iOS Target Properties
面闆的資訊到
Info.plist
<?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>CFBundleExecutable</key>
<string>iOS逆向</string>
<key>CFBundleIdentifier</key>
<string>blog.csdn.net.z929118967</string>
<key>CFBundleName</key>
<string>YourAppName</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchScreen</key>
<dict>
<key>UILaunchScreen</key>
<dict/>
</dict>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>