xcode 10.2 & ionic 3 build error : duplicate symbols for architecture x86_64 - xcode

ld: 6 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
Any idea what is the problem ?
can't build using xcode 10.2
ionic info
Ionic:
Ionic CLI : 5.0.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.10
Cordova:
Cordova CLI : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 26 other plugins)
Utility:
cordova-res : 0.5.2
native-run : not installed
System:
ios-deploy : 1.9.4
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
cordova plugin list
call-number 0.0.2 "Cordova Call Number Plugin"
com-badrit-base64 0.2.0 "Base64"
cordova-open-native-settings 1.5.2 "Native settings"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-contacts 3.0.1 "Contacts"
cordova-plugin-decimal-keyboard 1.0.0 "Decimal Keyboard"
cordova-plugin-decimal-keyboard-wkwebview 1.0.3 "Decimal Keyboard"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-intercom 6.2.0 "Intercom"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-qrscanner 3.0.1 "QRScanner"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.4.7 "SocialSharing"
cordova-sms-plugin 0.1.13 "Cordova SMS Plugin"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
es6-promise-plugin 4.2.2 "Promise"
phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"
ld: 6 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/emulator/***************** normal x86_64
(1 failure)
CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args: -***************** ... ******* ,-UseModernBuildSystem=0'
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
[ERROR] An error occurred while running subprocess cordova.
cordova build ios --verbose --buildFlag=-UseModernBuildSystem=0 exited with exit code 1.

The problem was conflict between 2 cordova-plugins.
cordova-plugin-decimal-keyboard-wkwebview
and
cordova-plugin-ionic-webview
I removed cordova-plugin-decimal-keyboard-wkwebview and it worked fine.

A thing that should also be noted and fixed the error message on my side, was to delete the relevant folder of the app inside the DerivedData Folder found in /Users/USERNAME/Library/Developer/DerivedData/
Was also mentioned on other similar error messages

For anyone facing this issue in 2022, my problem was with cordova-universal-links-plugin. Removing this plugin made the build succeed.

Related

Unable to add android platform

I am doing a ionic 6 project having node -v v16.13.1 and npm -v 8.1.2
I did "npm install" and after that when i run "ionic cordova platform add android" i get the below error. I am using Ubuntu Terminal. this happens only if i use node above v10.17.0. Please let me know how to fix this.
**Error: spawn ENOTDIR**
at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:698:9)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:12:24)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/utils-subprocess/dist/index.js:169:12)
at Subprocess.spawn
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/utils-subprocess/dist/index.js:142:16)
at Subprocess.run
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/utils-subprocess/dist/index.js:104:24)
at Shell.run (/usr/local/lib/node_modules/ionic/lib/shell.js:31:34)
at async PlatformCommand.runCordova
(/usr/local/lib/node_modules/ionic/commands/cordova/base.js:122:13)
at async PlatformCommand.run
(/usr/local/lib/node_modules/ionic/commands/cordova/platform.js:77:9)
at async Promise.all (index 0)
Output of my "ionic info" command:
Ionic:
Ionic CLI : 5.4.10 (/usr/local/lib/node_modules/ionic)
Ionic Framework : #ionic/angular 6.1.11
#angular-devkit/build-angular : 13.2.6
#angular-devkit/schematics : 13.2.6
#angular/cli : 13.2.6
#ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 3.5.1
#capacitor/core : 3.5.1
Cordova:
Cordova CLI : not installed
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run : 1.6.0
System:
Android SDK Tools : 26.1.1 (/home/etpl41/Android/Sdk)
NodeJS : v16.13.1 (/home/etpl41/.nvm/versions/node/v16.13.1/bin/node)
npm : 8.1.2
OS : Linux 4.4
Regards,
Rupak

Nativescript Error: Executing webpack failed with exit code 1

I've done a fresh install of Nativescript on a new iMac (running Big Sur) following the instructions carefully (from https://docs.nativescript.org/environment-setup.html#macos-ios).
It was working fine after the install yesterday, but today I cannot run apps in ios simulator (or in an Android virtual device).
The ns doctor command in terminal gives me this initially:
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.5.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.0.2 version and is up to date.
However, when I create a new app (ns create) and then try to run in (ns run ios), I get this error: Executing webpack failed with exit code 1.
The error messages start with this: TypeError: Cannot read property 'resolved' of undefined.
The same thing is also happening when I try to run it on Android.
After trying to run it on both ios and Android, ns doctor adds these lines:
✔ Component #nativescript/core has 8.0.8 version and is up to date.
✔ Component #nativescript/ios has 8.0.0 version and is up to date.
✔ Component #nativescript/android has 8.0.0 version and is up to date.
So it seems like the platforms are being added properly.
Any help would be greatly appreciated!
The full error message is:
Searching for devices...
Preparing project...
webpack is watching the files...
/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817
if (entry.resolved !== undefined) return entry.resolved;
^
TypeError: Cannot read property 'resolved' of undefined
at getResolvedTimestamp (/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817:12)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:1167:21
at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:352:5
at Hook.eval [as callAsync] (eval at create (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
at AsyncQueue._handleResult (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:322:21)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:305:11
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3098:21
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3010:22
at /Users/student/Desktop/testApp/node_modules/neo-async/async.js:2830:7
at done (/Users/student/Desktop/testApp/node_modules/neo-async/async.js:2925:13)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:2994:23
at Array.<anonymous> (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/fs.js:311:21)
at runCallbacks (/Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:27:15)
at /Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:200:4
at callback (/Users/student/Desktop/testApp/node_modules/graceful-fs/polyfills.js:299:20)
Executing webpack failed with exit code 1.
Thank you for reporting this, we have confirmed a breaking change in the latest webpack release:
https://github.com/webpack/webpack/releases/tag/v5.51.1
You can switch your package.json to use the rc as follows to resolve this right now:
"devDependencies": {
...
"#nativescript/webpack": "rc"
},
Then ns clean and you should be able to run your app now.
We also published another beta tag pinning webpack to 5.50.0 so doing ns clean without making any other dependency change in your own package.json should also work now.

React native build failed - xcodebuild: error: The workspace named "foo" does not contain a scheme named "foo"

I have a react native app that when Run from XCode it works as expected (builds and runs on a simulator). But when I try run it from my terminal with
npx react-native run-ios
I get the error:
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 foo.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace foo.xcworkspace -configuration Debug -scheme foo -destination id=FEB37
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: The workspace named "foo" does not contain a scheme named "foo". The "-list" option can be used to find the names of the schemes in the workspace.
It might have something to do with my schemes here
When I manage my schemes in XCode I do NOT see scheme 'foo'. It is a generic app so it uses scheme 'bar' which is in the XCode manage gui.
I've also tried
npx react-native run-ios --configuration Debug --scheme Development
and get a very large logout with it ending in:
** BUILD FAILED **
The following build commands failed:
MergeSwiftModule normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
If I downgrade XCode from 12.5 to 12.0.1 it works as expected. But I would like to use the latest XCode.
If I run react-native info
info Fetching system and libraries information...
(node:11609) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: macOS 11.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU # 2.30GHz
Memory: 905.50 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 28, 29, 30
Build Tools: 29.0.2, 30.0.3, 31.0.0
System Images: android-28 | Google Play Intel x86 Atom, android-29 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.2 AI-202.7660.26.42.7351085
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 15.0.2 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
I've tried restarting my mac...
Do I have to wait for dependencies to be updated?
Here is the Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'vicinity' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
end
post_install do |installer|
react_native_post_install(installer)
end
I have also tried to clean and rerun the start script.
Any help in getting this to build in terminal would be great.
Here is the last bit of the build failure logs:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -merge-modules -emit-module /Users/grant/Library/Developer/Xcode/Derivtes.noindex/Pods.build/Debug-iphonesimulator/lottie-react-native.build/Objects-normal/x86_64/lottie_react_native.swiftmodule
<unknown>:0: error: fatal error encountered while reading from module 'lottie_react_native'; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
<unknown>:0: note: module 'lottie_react_native' full misc version is '5.4(5.4)/Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)'
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
could not deserialize type for 'ContainerView': top-level value not found
Cross-reference to module 'lottie_react_native'
... RCTView
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Devel...ld/Debug-iphonesimulator/lottie-react-native.build/Objects-normal/x86_64/lottie_react_native.swiftmodule
1. Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
2. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module lottie_react_native)
0 swift-frontend 0x000000010c7e5e85 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift-frontend 0x000000010c7e4e78 llvm::sys::RunSignalHandlers() + 248
2 swift-frontend 0x000000010c7e6446 SignalHandler(int) + 262
3 libsystem_platform.dylib 0x00007fff2066ed7d _sigtramp + 29
4 libdyld.dylib 0x00007fff20643d08 _dyld_fast_stub_entry(void*, long) + 65
5 libsystem_c.dylib 0x00007fff2057e411 abort + 120
6 swift-frontend 0x0000000108554384 swift::ModuleFileSharedCore::fatal(llvm::Error) + 100
7 swift-frontend 0x00000001084d9b48 swift::ModuleFile::fatal(llvm::Error) + 2600
8 swift-frontend 0x000000010853d824 swift::SILDeserializer::readVTable(llvm::PointerEmbeddedInt<unsigned int, 31>) + 2532
9 swift-frontend 0x00000001085c21cb swift::SILDeserializer::getAll(bool) + 107
10 swift-frontend 0x0000000107ea2393 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 10899
11 swift-frontend 0x0000000107fae50d swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 205
12 swift-frontend 0x0000000107ea64ac llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 780
13 swift-frontend 0x0000000107ea2d3f swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&) + 143
14 swift-frontend 0x0000000107a0602e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7150
15 swift-frontend 0x0000000107987e82 main + 1266
16 libdyld.dylib 0x00007fff20644f5d start + 1
17 libdyld.dylib 0x0000000000000087 start + 18446603339972718891
=== BUILD TARGET react-native-splash-screen OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies
CompileC /Users/grant/Library/Developer/Xcode/Derive...t-native-splash-screen/react-native-splash-screen-dummy.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/grant/repos/foo/foo-centres-app/packages/app/ios/Pods
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/De...dk/tools:/Users/grant/Library/Android/sdk/tools/bin:/Users/grant/Library/Android/sdk/platform-tools"
/Applications/Xcode.app/Contents/Developer/Toolc...ld/Debug-iphonesimulator/react-native-splash-screen.build/Objects-normal/x86_64/react-native-splash-screen-dummy.o
CompileC /Users/grant/Library/Developer/Xcode/Derived...app/node_modules/react-native-splash-screen/ios/RNSplashScreen.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/grant/repos/foo/foo-centres-app/packages/app/ios/Pods
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/D...y/Android/sdk/tools/bin:/Users/grant/Library/Android/sdk/platform-tools"
/Applications/Xcode.app/Contents/Developer/...uild/Debug-iphonesimulator/react-native-splash-screen.build/Objects-normal/x86_64/RNSplashScreen.o
** BUILD FAILED **
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
MergeSwiftModule normal x86_64 /Users/grant/Library/Developer/Xcode/DerivedData/foo-...or/lottie-react-native.build/Objects-normal/x86_64/lottie_react_native.swiftmodule
(2 failures)
info Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #foo/foo-centres-app-app#3.0.3 start: `scripts/start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #foo/foo-centres-app-app#3.0.3 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
➜ ~/repos/foo/foo-centres-app/packages/app git:(update-release-app-v2) ✗
The output of xcodebuild -list
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Information about project "foo":
Targets:
foo
Build Configurations:
Debug
Release
Emp
Chad
Test
PreProduction
Master
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
Chad
Development
Emp
Master
PreProduction
Release
Test
I suspect something else..
please check beyond the schema such as accessibility/permission. Since there are more than one reasons this can happen, I recommend verifying all below.
// a very helpful debug
xcodebuild -list
Basic Debug xcodebuild -list; once they are configured correctly, shared they will successfully should up as shared for you.
      
Default configuration of Schemes is private you have to configure/make it shared
In the terminal/command-line build, the Xcode UI never runs and the xcoderun tool doesn't have its own cache of Schemes to work with.
Step 1: Make your schema accessible to the command-line build
Make your schema accessible to the command-line build by changing it to a shared scheme.
Menu > Product > Scheme > Manage Schemes
Verify/Check off the 'Shared' box for that scheme
Select Schema you want to create and click on the Edit button
Uncheck and Checkoff just to be sure the "Shared" checkbox.
Now go to WorkspaceName.xcworkspace/xcshareddata/xcschemes
Now verify a new .xcscheme file has been created in your project at
WorkspaceName.xcworkspace/xcshareddata/xcschemes.
Please remember to commit this file to your repository, so that your CI builds will also work
Verify again, since the folder names are case sensitive
From your build or release configuration path
      
      
Step 2: Do you have cocoapods - yes/no
NO, If your project is NOT using cocoapods , then you should delete the .xcworkspace file from ./ios directory.
yes, or if you are using a workspace (e.g. with pods), debug/verify like so, here..
// a very helpful debug
xcodebuild -workspace MyProject.xcworkspace -list
Another question on SO, with different approach
Step 3:
If you previously created the folder from step 1, or for some reason renamed/edited project, then go in an update the names manually
Open Foo as a directory in finder.
Open the folder xcshareddata/xcschemes
Rename the xcscheme files there
Can you make sure you're using the right version of Xcode, by running xed --version. There might be a mismatch with the Xcode version that React Native is using (not that this should cause a problem by itself)? You can change it with xcode-select.
Can you try upgrade lottie-react-native to 4.0.2, using npm i lottie-react-native#4.0.2, you're using 3.5.0.
Can you try upgrade lottie-ios to 3.2.3, using npm i lottie-ios#3.2.3
Then make sure you run cd ios and pod install
If you get linker warnings, follow this
If you get desperate, you can delete the ios folder and regenerate it by running by creating a new project with the same name, and copying the iOS folder into your existing project. Or you can just compare the 2 projects/ schemes, and see what you're missing.
Good luck 🙂
Looking at this output from xcodebuild -list
Information about project "foo":
Targets:
foo
Build Configurations:
Debug
Release
Emp
Chad
Test
PreProduction
Master
If no build configuration is specified and -scheme is not passed then "Release" is used.
Schemes:
Chad
Development
Emp
Master
PreProduction
Release
Test
And this error from npx react-native run-ios -
xcodebuild: error:
The workspace named "foo" does not contain a scheme named "foo".
The "-list" option can be used to find the names of the schemes in the workspace.
The error says that - the target foo (listed under Targets: in the output) should have a corresponding scheme called foo (that should have been listed under Schemes: in the output) which it can't find while using npx react-native run-ios.
As you say, you are able to run this from Xcode successfully, you should note which scheme are you running. You can find it on the top left corner - right next to play / stop buttons. Adventure iOS in the below screenshot is the scheme.
Note down it's name (case sensitive), make sure it's listed under Schemes: in the above output, if it's not - make sure it's shared (Edit Scheme > Check the Shared Checkbox).
After that you can run using command line using that scheme name like following - say you are successfully running "Chad" scheme from Xcode, run that using command line like this.
npx react-native run-ios --scheme "Chad"

Flutter project failing to build on Mac M1

I have recently bought a new Mac book with the M1 chip and faced huge issues between Flutter and Firebase in building. I will list both the Flutter error log and Xcode error log.
Note: I'm building on Flutter channel Master
Flutter Error Log:
Launching lib/main.dart on iPod touch (7th generation) in debug mode...
Xcode build done. 69.1s
Failed to build iOS app
Error output from Xcode build:
objc[30795]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fe91f8f0) and ?? (0x1189402b8). One of the two will be used. Which one is undefined.
objc[30795]: Class AMSupportURLSession is implemented in both ?? (0x1fe91f940) and ?? (0x118940308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPlugin.m:141:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
[[[UIAlertView alloc] initWithTitle:#"Error"
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
#interface UIAlertView : UIView
^
1 warning generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:17:44: warning: 'UIImagePickerControllerReferenceURL' is deprecated: first deprecated in iOS 11.0 - Will be removed in a future release, use PHPicker. [-Wdeprecated-declarations]
NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL];
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:62:51: note: 'UIImagePickerControllerReferenceURL' has been explicitly marked deprecated here
UIKIT_EXTERN UIImagePickerControllerInfoKey const UIImagePickerControllerReferenceURL API_DEPRECATED("Will be removed in a future release, use PHPicker.", ios(4.1, 11.0)) API_UNAVAILABLE(tvos); // an NSURL that references an asset in the AssetsLibrary framework
^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:21:47: warning: 'fetchAssetsWithALAssetURLs:options:' is deprecated: first deprecated in iOS 11 - Will be removed in a future release [-Wdeprecated-declarations]
PHFetchResult<PHAsset *> *result = [PHAsset fetchAssetsWithALAssetURLs:#[ referenceURL ]
^
In module 'Photos' imported from /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.h:6:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h:74:1: note: 'fetchAssetsWithALAssetURLs:options:' has been explicitly marked deprecated here
+ (PHFetchResult<PHAsset *> *)fetchAssetsWithALAssetURLs:(NSArray<NSURL *> *)assetURLs options:(nullable PHFetchOptions *)options API_DEPRECATED("Will be removed in a future release", ios(8, 11), tvos(8, 11)) API_UNAVAILABLE(macos);
^
2 warnings generated.
1 warning generated.
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/wissamboughannam/Library/Developer/Xcode/DerivedData/Runner-awkucyxpawezvvfjchbivjxuwsah/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/file_picker.build/Objects-normal/x86_64/FilePickerPlugin.o /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.4.2/ios/Classes/FilePickerPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:58:28: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRLoggerInitializeASL() {
^
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:101:20: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRResetLogger() {
^
2 warnings generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
As for the Error log from Xcode:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
This is the main error, there were many warning, but I'm not sure if they're causing the build failure.
Running flutter doctor result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-11.0.pre.227, on macOS 11.1 20C69 darwin-arm, locale en-SA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
• No issues found!
As we know that m1 mac runs on arm based processor and thus few things like cocoa pods and ffi needs to be build based on that.
After a long research i came up with few steps which will definitely help everytime you stuck with xcode flutter application build for m1 mac.
To install completely cocoapods on Mac with M1 chip (Apple Silicon), please follow those steps:
Cocoa Pods Installation in M1
sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin
Install ffi
sudo arch -x86_64 gem install ffi
#update repo
arch -x86_64 pod install --repo-update
Flutter iOS builds
flutter clean
flutter build ios
Re-install dependency in iOS folder of flutter project
arch -x86_64 pod install
I also have an M1 Mac, and am on the stable channel, without any errors.
Try switching to stable first.
Also, try running $ flutter clean and again building the app.
I removed all depreciations and the project ran perfectly.
i had another issue related to flutter dependency that showing error OBJC_CLASS on firebase dependency, image cropper, stripe, etc.
My xcode disable archive & distribute menu because no successful build to archive.
I resolved it with this idea: build the app on terminal/android studio, then archive & distribute on xcode.
The step is:
uninstall cocoapods
sudo gem uninstall cocoapods
install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
nano ~/.zshrc
export PATH="/opt/homebrew/bin:$PATH"
brew --version
install cocoapods
brew install cocoapods
pod --version
link xcode
flutter doctor
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
go to your flutter project and
flutter clean
flutter pub get
cd ios
pod install
pod update
open Runner.xcworkspace with xcode and set your signing & capabilities
open terminal on your flutter project and build
flutter build ios --release
This will build Runner.app
Go to xcode, on Runner choose any ios device (arm64), to enable archive.
Then
product-> archive->distribute app->next->manual signin->set your certificate distributor
This will build your .ipa

Lint Error for pod library Swift 4 Xcode 9

I'm creating a pod for my swift 4 for library.
I run pod lib create IntentedLibraryName which generates the workspace. Then I did the necessary modifications to the files IntentedLibraryName.podspec, and moving my library swift files to the path IntentedLibraryName/Classes/.
To test out if the pod works, I've Build and pod install from the Example project and everything works as intended.
Now, I run pod lib lint IntentedLibraryName.podspec --verbose then I got
(1 failure) === BUILD TARGET IntentedLibraryName OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor. The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor
I did the following hoping it would fix it:
In the Pod project, From Build Settings > Swift Compiler- Language > Swift Language Version from Swift unspecified to Swift 4.0.
I added and committed all changes along the tag (i.e git tag 0.0.1) and push all it with --tags. (i.e git push -u origin dev --tags)
I run the linting command again, and still the same issue.
I even try toecho 4.0 > .swift-version save all commit and push it again. NADA
Also tried s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' } NADA
## CocoaPods Environment
ℹ Please replace this with the output of `pod env`.
e.g. via `pod env | pbcopy`
### Stack
```
CocoaPods : 1.4.0.beta.1
Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
RubyGems : 2.5.1
Host : Mac OS X 10.12.6 (16G1023)
Xcode : 9.0 (9A235)
Git : git version 2.8.1
Ruby lib dir : /Users/lamour/.rvm/rubies/ruby-2.3.0/lib
Repositories : bahlo - https://github.com/bahlo/SwiftGif # d26325392aefe7822dea79a757d4e300c694d010
master - https://github.com/CocoaPods/Specs.git # f2169476eead8b1a9d898ff73c5eba516504ed78
```
### Installation Source
```
Executable Path: /Users/lamour/.rvm/gems/ruby-2.3.0/bin/pod
```
### Plugins
```
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
```
Project that demonstrates the issue
Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
i.e. it's only an issue with CocoaPods the tool.
I do think its an issue with Xcode 9.0 because I've created empty project, still same thing happened.
Thanks for the help :)
Issue Fixed
The issue had nothing to do with Xcode 9 but it was with cocoapods. I did uninstall cocoapods from my machine and install it again. Once you done make sure you had the echo 4.0 > .swift-version. Voila :)
echo 4.0 > swift-version
should be
echo 4.0 > .swift-version
right (NB the leading dot)?
I had the same problem and for whichever reason, in my .swift-version file there was a strange
2.4 =>
in it (sic).
After I changed it to
4.0
, everything worked.
Example project here:
https://github.com/karstengresch/CleanroomLogger (actually a dumb fork of CleanRoomLogger which I want to use with Cocoapods).

Resources