Soy's Devlog
xcode 배포 오류 본문
xcode에서 Archive 후에 배포를 진행 할 때 발생할 수 있는 몇 가지 오류들이 있다.
물론 경우에 따라 오류내용도 다르겠지만, 배포 전에 미리 확인하면 안봐도 되는 오류이기 때문에 발생한 원인과 해결법을 정리해 보았다.
1)
App Store Connect Operation Error
Unsupported Architectures. The executable for MyAPP.app/Frameworks/MargaretOfflineFramework.framework contains unsupported architectures '[x86_64]'.
-> 애플 정책 상 시뮬레이터 아키텍처(x86_64)가 포함된 채 배포를 진행하면 앱스토어에 앱을 업로드 할 수 없다. i386과 x86_64에 대해 삭제가 필요하다. 터미널로 프로젝트의 디렉토리에서 lipo명령으로 carthage 폴더의 라이브러리 중 관련 항목을 삭제해 준다
lipo -remove i386 ./Carthage/Build/iOS/SQLite.framework/SQLite -o ./Carthage/Build/iOS/SQLite.framework/SQLite
lipo -remove x86_64 ./Carthage/Build/iOS/SQLite.framework/SQLite -o ./Carthage/Build/iOS/SQLite.framework/SQLite
제대로 제거 되었는지도 확인해 본다
lipo -info ./Carthage/Build/iOS/SQLite.framework/SQLite
2)
App Store Connect Operation Error
Missing required icon file. The bundle does not contain an app icon for iPad of exactly '167x167' pixels, in .png format for iOS versions supporting iPad Pro. To support older operating systems, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface
-> 바로 첫 줄에 나오듯 Assets에 특정 사이즈의 이미지 파일이 누락되었으니 추가하여 배포를 진행하라는 것이다.
3)
App Store Connect Operation Error
Redundant Binary Upload. You've already uploaded a build with build number '1' for version number '1.0'. Make sure you increment the build string before you upload your app to App Store Connect. Learn more in Xcode Help (http://help.apple.com/xcode/mac/current/#/devba7f53ad4).
-> 처음 build 번호가 1 이었다면 새로운 배포를 진행할 땐 이전 build번호와 동일하지 않게 맞춰준 후 배포를 진행하라는 뜻이다.
여기서는 1.0 혹은 1.0.1등 앱의 업데이트 내역에 따라 번호를 지정해 주면 배포가 가능하다.
4)
App Store Connect Operation Error
This bundle is invalid. The value for key CFBundleShortVersionString [1.0] in the Info.plist file must contain a higher version than that of the previously approved version [1.0]. Please find more information about CFBundleShortVersionString at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
-> 마찬가지로 version 또한 최초 배포가 아니라면 업데이트 배포 시 에는 version이 올라가야 한다. 수정하여 진행하면 된다.
5)
App Store Connect Operation Error
Invalid Segment Alignment. The app binary at 'MyAPP.app/Frameworks/MargaretOfflineFramework.framework/MargaretOfflineFramework' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.
App Store Connect Operation Error
The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker.
-> 1) 번의 오류와 비슷한 원인으로 발생하는 오류이다. 시뮬레이터 아키텍처(x86_64)와 실제장치에 대한 빌드가 포함되어 있기 때문에 배포를 진행할 수 없는 것이고, 수동으로 삭제 해 주어야 한다.
삭제할 수 있는 shell script 를 프로젝트 타겟의 Build Phases 에서 + 버튼으로 New Run Script Phase를 추가 해 준다.
그러면 하단에 Run Script 메뉴가 생성되고 shell을 입력할 수 있는 창이 보인다.
이곳에 아래의 shell script를 입력 해 주고 다시 배포를 진행하면 된다!
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
script를 추가하지 않고 터미널에서 제거하는 방법도 있다.
//경로가 cd /Users/MAC/Desktop/MyProject/MyApp.framework 와 같다면
lipo -remove i386 MyApp -o MyApp && lipo -remove x86_64 MyApp -o MyApp
참고
https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86