Fastlane with XCode 14: ARCHIVE FAILED - ios

My current version of Fastlane 2.173.0 works OK with XCode 13 and builds and publishes my iOS RN/Native project to TestFlight. But after moving to XCode 14 I have got next error on start building (gym).
[16:56:49]: $ set -o pipefail && xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/vagrant/Library/Developer/Xcode/Archives/2022-10-31/MyProject\ 2022-10-31\ 16.56.49.xcarchive archive | tee /var/folders/9l/1ysg9vq51p37q0lgksxhdb9r0000gn/T/fastlane_logs3640665801/gym/MyProject-MyProject.log | xcbeautify
[16:56:52]: ▸ Resolve Package Graph
[16:56:54]: ▸ Resolved source packages
[16:56:54]: ▸ DLog - https://github.com/ikhvorost/DLog # 1.4.0
[16:56:54]: ▸ PromiseQ - https://github.com/ikhvorost/PromiseQ.git # 1.7.0
[16:56:54]: ▸ Realm - https://github.com/realm/realm-cocoa.git # 10.15.1
[16:56:54]: ▸ RealmDatabase - https://github.com/realm/realm-core # 11.4.1
[16:57:10]: ▸ ⚠️ Run script build phase 'Bundle Settings File' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Embed Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ** ARCHIVE FAILED **
gym fails immediately after start from the above log. I've tied to upgrade Fastlane, Ruby, Cocoapods to the latest versions but it doesn't help and I'm still observing the failure.
I need to use new iOS SDK from XCode 14 for new features so how to fix "ARCHIVE FAILED" issue?

XCode 14 strictly checks your project and distribution settings, "Development Team" and Bitcode for pods etc. from the one side, and maybe has some bugs from the other.
You should make next changes to avoid the issue:
Remove Mac Catalyst from the destinations (if you don't use it) in your project:
General > Supported Destinations
Disabling signing, bitcode and Mac Catalyst for all your pods in Podfile:
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
flipper_post_install(installer)
# XCode 14 fix
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SUPPORTED_PLATFORMS'] = 'iphoneos iphonesimulator'
config.build_settings['SUPPORTS_MACCATALYST'] = 'NO'
config.build_settings['SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD'] = 'NO'
end
end
end
end
Update Fastlane to 2.210.1 because it has fix for deliver and pilot.

Related

react-native ios build error, SwiftEmitModule normal x86_64 Emitting\ module\ for\ KakaoSDKAuth (in target 'KakaoSDKAuth' from project 'Pods')

This is React Native app that contains android and ios. I can run android simulator just fine, but the problem is when trying to run and build ios simulator. I installed all the necessary packages by running this command pod install at /ios directory. This Macbook chip is M1. I have been trying many different ways to fix it for hours, but couldn't find a solution. Thank you.
Then the error is below:
yarn run v1.22.19
warning package.json: "dependencies" has dependency "react-dom" with range "17.0.1" that collides with a dependency in "devDependencies" of the same name with version "^17.0.2"
warning package.json: "dependencies" has dependency "react-native-web" with range "0.17.1" that collides with a dependency in "devDependencies" of the same name with version "^0.16.3"
$ react-native run-ios
info Launching iPhone 12 (iOS 16.0)
info Building (using "xcodebuild -workspace PolicyholderApp.xcworkspace -configuration Debug -scheme PolicyholderApp -destination id=C35CD837-FCAB-4B39-BA3C-B52F65AF113D")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening PolicyholderApp.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace PolicyholderApp.xcworkspace -configuration Debug -scheme PolicyholderApp -destination id=C35CD837-FCAB-4B39-BA3C-B52F65AF113D
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Prepare packages
Run pre-actions
SchemeAction Run\ Script /var/folders/6n/7yp6ql7s72j_l_47mk1r9sg80000gn/T/SchemeScriptAction-0nKoVj.sh
cd /var/folders/6n/7yp6ql7s72j_l_47mk1r9sg80000gn/T/
export ACTION=build
export ADDITIONAL_SDKS=
export AD_HOC_CODE_SIGNING_ALLOWED=YES
export ALLOW_TARGET_PLATFORM_SPECIALIZATION=NO
...
continue... and at the end
** BUILD FAILED **
The following build commands failed:
SwiftEmitModule normal x86_64 Emitting\ module\ for\ KakaoSDKAuth (in target 'KakaoSDKAuth' from project 'Pods')
(1 failure)
Podfile
...
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
# Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
# Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
end
end
In Xcode, I tried to change its Build System to be Legacy Build System. Cleared all the files in /Library/Developer/Xcode/DerivedData directory. Cleared node_modules, /ios/Pods, /ios/Podfile.lock and re-installed them. None of them worked.

Error runing Xcode build on Flutter using TensorFlowLite

I'm creating an app on Flutter using the TensorFlowLite library and after finishing all the Flutter Code, I'm trying to debug it on a iOS Simulator and on the console I'm getting the following error:
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/13/q8h3_c012wvc3mxcfpzrf6fr0000gn/T/flutter_tools.8a658a/flutter_ios_build_temp_dirNlQoAO/temporary_xcresult_bundle
/Users/chrisley/terminal-addons/flutter/.pub-cache/hosted/pub.dartlang.org/tflite-1.1.2/ios/Classes/TflitePlugin.mm:20:9: fatal error: 'TensorFlowLiteC.h' file not found
#import "TensorFlowLiteC.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
error: the following command failed with exit code 1 but produced no further output
CompileC /Users/chrisley/Library/Developer/Xcode/DerivedData/Runner-eguofderrkwgjseuiagmsjusmxtx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/tflite.build/Objects-normal/arm64/TflitePlugin.o /Users/chrisley/terminal-addons/flutter/.pub-cache/hosted/pub.dartlang.org/tflite-1.1.2/ios/Classes/TflitePlugin.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'tflite' from project 'Pods')
note: Building targets in dependency order
/Users/chrisley/Documents/Development/Flutter/tensorflow_test/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'TensorFlowLiteC' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/13/q8h3_c012wvc3mxcfpzrf6fr0000gn/T/flutter_tools.8a658a/flutter_ios_build_temp_dirNlQoAO/temporary_xcresult_bundle
Lexical or Preprocessor Issue (Xcode): 'TensorFlowLiteC.h' file not found
/Users/chrisley/terminal-addons/flutter/.pub-cache/hosted/pub.dartlang.org/tflite-1.1.2/ios/Classes/TflitePlugin.mm:19:8
2
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
I tried to solve the error adding pod 'TensorFlowLiteObjC' in the Podfile but it didn't work.

Flutter Build errors xcode ios

After upgrading to Xcode 14, I got these errors messages when I try build/run my project on Mac:
Android studio -> Build -> Flutter -> Build iOS
shared_preferences: ^2.0.15
Flutter version: 3.3.2
Note that everything were working without any problem before the upgrading, and no problem in Windows.
Automatically signing iOS for device deployment using specified development team in Xcode project: 65456KJ35R
Running Xcode build...
Xcode build done. 18.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/cc/3b8b8j7s3nd92qwt4_6zgzhh0000gn/T/flutter_tools.DBua0Q/flutter_ios_build_temp_dirdSTTIY/temporary_xcresult_bundle
/Users/test/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/ios/Classes/FLTSharedPreferencesPlugin.m:27:41: error: no type or protocol named 'FlutterPluginRegistrar'
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
^
/Users/test/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/ios/Classes/FLTSharedPreferencesPlugin.m:29:34: error: property 'messenger' not found on object of type 'NSObject *'
UserDefaultsApiSetup(registrar.messenger, plugin);
^
3 errors generated.
Command SwiftCompile failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/cc/3b8b8j7s3nd92qwt4_6zgzhh0000gn/T/flutter_tools.DBua0Q/flutter_ios_build_temp_dirdSTTIY/temporary_xcresult_bundle
Generics Issue (Xcode): No type or protocol named 'FlutterPlugin'
/Users/test/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/ios/Classes/FLTSharedPreferencesPlugin.h:5:50
Generics Issue (Xcode): No type or protocol named 'FlutterPluginRegistrar'
/Users/test/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/ios/Classes/FLTSharedPreferencesPlugin.m:26:40
Semantic Issue (Xcode): Property 'messenger' not found on object of type 'NSObject *'
/Users/test/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/ios/Classes/FLTSharedPreferencesPlugin.m:28:33
Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code
Encountered error while building for device.
Process finished with exit code 1
flutter run -v
flutter.txt
flutter build ios -v
iosbuild.log
I tested to build the new project with only shared_preferences: ^2.0.15 package and here is the result :
buildlog.log
Following packages have also conflicts while building for iOS in Mac
searchable_dropdown: ^1.1.3
file_picker: ^4.6.1
html_editor_enhanced: ^2.5.0
image_cropper: ^3.0.0

Cannot run flutter app in iOS simulator: warning: [CP] Unable to find matching .xcframework slice in ... [Flutter]

I am getting this error when I run my flutter project in iOS simulator:
warning: [CP] Unable to find matching .xcframework slice in myProject/ios/Pods/FirebaseFirestore/FirebaseFirestore/abseil.xcframework abseil framework ios-i386_x86_64-simulator ios-x86_64-maccatalyst ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).
In android emulator and iOS device it's working fine.
Worked for me:
rm ios/Podfile
Then upgrade your packages:
flutter pub upgrade
And update your podfile:
cd ios && pod update
Then clean and run:
flutter clean && flutter run
In order to fix that issue I was needed to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes for the library. You can do that manually but changes will be lost once you re-run pod install.
In order to set that automatically you can make necessary changes in your ios/Podfile, here's code example:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
This was inspired by another answer, you can find more info if you need by following that link https://stackoverflow.com/a/64139830/1078641

xcrun does not set rbenv shell version, .xcarchive is malformed. Fastlane, ios, react native

I am trying to deploy my ios react-native app to the AppStore, using fastlane to automate the deployment for beta testing with TestFlight. However, my fastlane beta command builds the app then fails after the archive succeeded in building.
The part failing is:
rbenv detected, removing env variables
rbenv: shell integration not enabled. Run `rbenv init' for instructions.
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/hq/xkbjj40x4gv1hx_q80vj7rh40000gn/T/gym_config20210223-39939-lz42w9.plist -archivePath './builds/project 2021-02-23 15.21.33.xcarchive' -exportPath /var/folders/hq/xkbjj40x4gv1hx_q80vj7rh40000gn/T/gym_output20210223-39939-1ehxxzu
error: archive at path '/Users/me/project/ios/builds/project 2021-02-23 15.21.33.xcarchive' is malformed
** EXPORT FAILED **
If I run xcrun rbenv init it produces the expected output, and my .zshrc and .bashrc contain eval "$(rbenv init -)" and xcrun has the same environment variables as my zsh. However, xcrun rbenv shell produces rbenv: shell integration not enabled. Run 'rbenv init' for instructions. as well as running xcrun rbenv shell 2.6.3. If rbenv shell 2.6.3 is run in zsh, rbenv is set to that version.
I suspect this may not be the cause of the issue, I've tried reinstalling xcode cli tools and reinstalling ruby. Before the Archive finishes in fastlane, the following warnings are given:
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'Flipper-RSocket' from project 'Pods')
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
[15:27:18]: ▸ no rule to process file '/Users/me/project/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'armv7' (in target 'Flipper-RSocket' from project 'Pods')
My Fastfile looks like:
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "project.xcodeproj")
get_certificates( # Create or get certificate, and install it
output_path: "./builds" # Download certificate in the build folder (you don't need to create the folder)
)
get_provisioning_profile( # Create or get provisioning profile
output_path: "./builds", # Download provisioning profile in the build folder
filename: "provisioning.mobileprovision" # Rename the local provisioning profile
)
update_project_provisioning( # Set the project provisioning profile (related in Xcode to the General > Signing Release section)
xcodeproj: "project.xcodeproj",
target_filter: "project", # Name of your project
profile: "./builds/provisioning.mobileprovision",
build_configuration: "Release"
)
update_project_team( # Set the right team on your project
teamid: CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
)
build_app(
workspace: "project.xcworkspace",
scheme: "project",
clean: true,
export_method: "app-store",
export_options: {
provisioningProfiles: {
CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) => CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) + " AppStore" # Value of this parameter is the name of the Provisioning Profile. By default, it will be "{bundleId} AppStore"
}
},
build_path: "./builds",
output_directory: "./builds")
upload_to_testflight
end
end
Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'project' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'projectTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
target 'project-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Had to update my mapbox package in package.json to a beta version that came out a week ago.
"#react-native-mapbox-gl/maps": "8.2.0-beta1",
https://github.com/react-native-mapbox-gl/maps/pull/1262

Resources