How do I reset the ios library in react-native? - ios

I have a new app that was initialised with
react-native init demo
and is run successfully using react-native run-ios.
I installed a few libraries using CocoaPods and now the react-native run-ios works but not the xcode build.
I tried deleting the Pods library, checking out all the files back to their original state, and repeating pod install but I still get the same error in xcode build :
Showing Recent Messages :-1: Cycle in dependencies between targets
'bridgeTests' and 'Pods-bridgeTests'; building could produce
unreliable results. Cycle path: bridgeTests → Pods-bridgeTests →
bridgeTests Cycle details: Target build order preserved because
“Parallelize Build” is off
→ Target 'bridgeTests' has target dependency on Target
'Pods-bridgeTests' → Target 'Pods-bridgeTests' has target dependency
on Target 'bridge' due to target order in a “Target Dependencies”
build phase or the scheme ○ That command depends on command in Target
'bridge': script phase “[CP] Copy Pods Resources”
I would like to somehow rebuild my entire ios library so that an xcode build would work just as the react-native run-ios works.
What's the solution?
Thanks,
Yaron

first delete ios & android folder, then do
react-native <= 0.59.10
react-native-cli <= 1.3.0
react-native eject
react-native <= 0.59.10
react-native-cli <= 1.3.0
react-native upgrade --legacy true
more...

Related

Flutter cannot find FirebaseCore.h

I'm trying to build a Flutter app for iOS, but I'm running into a weird issue where flutter build can't locate one of the header files (that's physically where it needs to be inside the Pods directory).
This is what I get when I try to build the app:
:ghost: zmeggyesi#Shiny-Platform:/Users/zmeggyesi/projects/site-overwatch/frontend/ios (tags/release-2.6.0)
$ flutter build ios --release --no-codesign --no-tree-shake-icons
Changing current working directory to: /Users/zmeggyesi/projects/site-overwatch/frontend
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building hu.skawa.dive-site-overwatch-ios for device (ios-release)...
Running pod install... 21.6s
Running Xcode build...
└─Compiling, linking and signing... 12.2s
Xcode build done. 50.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Firebase.h"
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Pods/Firebase/CoreOnly/Sources/Firebase.h:15:9: error:
'FirebaseCore/FirebaseCore.h' file not found
#import <FirebaseCore/FirebaseCore.h>
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Runner/AppDelegate.swift:3:8: error: could not build Objective-C module
'Firebase'
import Firebase
^
Command CompileSwift 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
Encountered error while building for device.
And I'm kind of at a loss as to what might be causing this, or how to get around it.
The relevant Firebase declarations in my Pubspec:
firebase_core: 1.1.1
firebase_crashlytics: 2.0.3
firebase_analytics: 8.0.4
firebase_auth: 1.1.4
firebase_remote_config: 0.10.0-dev.3
firebase_storage: 8.0.6
So far, I've tried:
Nuking the Pods directory and the Podfile.
Commenting out the Firebase dependencies from my pubspec, followed by a flutter pub upgrade to update the lockfile, then doing a pod install before re-enabling them to re-download the pods.
Running flutter create . to regenerate the project descriptors.
Nuking the derived data dir (~/Library/Developer/Xcode/DerivedData), the Workspace descriptor, and the Pods/Podfile to regenerate everything from scratch.
This seems to be an issue only since I migrated to Flutter 2 and the latest packages, and only when I try to build in release mode (running the app in debug via XCode or Android Studio seems to work fine).
Correction: now even the XCode native build is broken, with the same error...
Anyone have any more ideas I could try? This is driving me crazy...
try to change global platform in Podfile this:
Uncomment the next line to define a global platform for your project
-# platform :ios, '9.0'
+ platform :ios, '13.0'

Module 'connectivity not found' in iOS build of Flutter application

I have been trying to build my flutter app in iOS simulator but getting build error with following screenshot.
Where my Xcode version is 11.0, CocoaPods version 1.9.3, Flutter version 1.22.0
I have also upgraded connectivity package from 0.4.9+2 to 0.4.9+3 which is latest one. Following some steps by googling but no one is working yet. However my android build is fully ok.
Thanks in advance.
I have solved this issue through running this command in terminal at Project folder directory
rm ios/Podfile && flutter build ios
I solved this problem by setting in the podfile
platform :ios, '12.1'
And then later inserting the same version in Xcode as well
For me, it turned out that I was opening ios/Runner.xcodeproj instead of ios/Runner.xcworkspace.
Opening ios/Runner.xcworkspace from Xcode worked for me!
Alternatively, go to your flutter appname/ios folder and type in commandline:
sudo gem install cocoapods
flutter pub get <---may or may not be necessary for you
pod install
This will install the infuriating cocoapods to your project
If you are working with flavoured build, e.g staging, production, development.
Your app will most likely be running on Runner so click on runner and select the correct build build flavour which in this case would be one of the flavours.
I have this issue and this sequence of steps have worked for me.
Go to the ios folder #cd ios
Delete the Podfile #rm Podfile
Run flutter clean
Run flutter pub get
Case you need generate files with build_runner #flutter packages pub run build_runner build --delete-conflicting-outputs
Build for app for iOS. #flutter build ios
Generate your project pods. #cd ios && pod install
Build project from XCode
In many cases it comes because of difference between Pod install version in flutter and Xcode. Just check them or simply add 'platform :ios, '11.0'' to your podfile in flutter.
rm ios/Podfile && flutter build ios
Change the platform number on Podfile "platform :ios, '12.1" (in XCode: Pick 12.1v.--> Runner > info IOS Deployment Target: 12.1)
Open the flutter ios folder (right-click on ios folder in vs. code and click "Open in Xcode")
Go to Product > Schemes > New Scheme
Select the name of your Cocoapod, then click OK
build again
it's mean som dependencies missing on project. I solved same problem by this step.
cd /YourProject/iOS
rm Podfile
flutter clean On your IDE
flutter pub get
And cd /YourProject/iOS
pod install
in xode clear build and close xcode
and
run this in project folder.
flutter clean && fluttter pub get && cd ios && rm ios/Podfile && cd .. &&flutter build ios
open xcworkspace instead of xcodeproj.
build the project

ios build error: Multiple commands produce on "flutter run" from command line [duplicate]

Flutter iOS build fails after upgrading to Xcode 10.0 version in mac.
Nagendras-MacBook-Pro:uaenumber nagendra$ flutter run
Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done. 1.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: Multiple commands produce '/Users/dev/Documents/projects/Personal/uaenumber/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/dev/Documents/projects/Personal/uaenumber/ios/Flutter/Flutter.framework' to '/Users/dev/Documents/projects/Personal/uaenumber/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
warning: The use of Swift 3 #objc inference in Swift 4 mode is deprecated. Please address deprecated #objc inference warnings, test your code with “Use of deprecated Swift 3 #objcinference” logging enabled, and then disable inference by changing the "Swift 3 #objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner')
warning: ignoring duplicated output file: '/Users/nagendra/Documents/projects/Personal/uaedialer/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone X.
Xcode Version - 10.0 (10A255)
I tried to recreate the project and copied all the source files to the new project folder but it does not resolve the issue.
This solution worked for me.
Open ios/Runner.xcworkspace Select the Runner project in the project
navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the
embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep
App.framework).
It's a known issue. Here is the explanation and some workarounds:
https://github.com/flutter/flutter/issues/20685#issuecomment-421511890
Affected projects
This issue affects all Flutter projects built using Xcode 10 that have
a dependency on CocoaPods -- typically this means those that rely on
plugins. Workarounds
There are two workarounds:
Option 1: Use the legacy build system . As noted by #gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build
System.
Option 2: Use the new Xcode 10 build system.
Open ios/Runner.xcworkspace
Select the Runner project in the project navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep App.framework).
Root cause
When plugins are in use, there are two competing build actions that
copy Flutter.framework into the build application Frameworks
directory:
The Embed Frameworks build phase for the Runner project
The [CP] Embed Pods Frameworks build phase that pod install creates in the project.
Item (1) is there to ensure the framework is copied into the built app
in the case where there are no plugins (and therefore no CocoaPods
integration in the Xcode project). Item (2) is there because Flutter's
podspec declares Flutter.framework as a vended_framework, and
CocoaPods automatically adds a copy step for each such
vended_framework in the transitive closure of CocoaPods dependencies.
If you have tried everything and still cannot build the Archive successfully, then you look like my case.
It took me 3 business days to fix this. My problem happened after adding the Notification Services target to the project. But it looks like it will apply to many other cases as well:
The problem is caused by the library inside 2 target multiple commands produce. In my case, for example, in the project target and notification extension target, both GoogleUtilities had this causing them to conflict or duplicated the commands produce. The solution is to make that dependency explicit, at the top level.
The pod file will look like this:
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
pod 'GoogleUtilities' // Add this line is very important.
target 'MyProject' do
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
# Other pods
end
target 'NotificationService' do
pod 'Firebase/Messaging'
end
After run:
pod deintegrate
pod install
This issue was fixed by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.
Edit: The latest stable version of Flutter will migrate your Xcode project to the new build system (step one below) and avoid the multiple embedded frameworks warning altogether. If it doesn't, follow the instructions at https://flutter.dev/docs/development/ios-project-migration. You no longer need to edit your Podfile (step two below).
See https://github.com/flutter/flutter/issues/20685#issuecomment-622126064
Previous answer
Open ios/Runner.xcworkspace in Xcode. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true
3. In your Flutter app, build again to trigger a pod install, which will automatically clean up the build phase
flutter build ios
See:
https://github.com/flutter/flutter/issues/20685#issuecomment-509731873
https://github.com/flutter/flutter/issues/20685#issuecomment-510162863
Warning:
Do not revert to the Xcode deprecated legacy build system to fix this issue as suggested in the other answers.
I faced this problem today and nothing fixed it. Then i check my xcode project and i found that insider runner folder i found another runner show red which was not there before. So i delete that and rerun my project and it fixed my problem.
I try the above method but it didn,t fix my problem. But you can try both to see which one work for you.
Try this:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run

PODS_ROOT and other pods env variables not set when compiling Ionic app

I have built an Ionic 2 app which uses Intercom (a third-party extension). Intercom is installed using cocoapods.
When compiling my app I am given the errors:
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
This is being generated by the Build Phase [CP] Check Pods Manifest.lock:
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
# print error to STDERR
echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
exit 1
fi
# This output is used by Xcode 'outputs' to avoid re-running this script phase.
echo "SUCCESS" > "${SCRIPT_OUTPUT_FILE_0}"
I have tried outputting the environment variables PODS_PODFILE_DIR_PATH and PODS_ROOT in the STDERROR echo from the script above and both are blank. I can probably get around this specific error by amending those paths myself, but clearly something else more fundamental is broken, so I need to fix the actual issue itself.
Why are these variables blank?
I have additional build phases for [CP] Copy Pods Resources and [CP] Embed Pods Frameworks which run some shell scripts. I have tried changing the order of these with no luck.
My Podfile.lock and Podfile (which was auto-generated anyway) both seem good:
Podfile:
# DO NOT MODIFY -- auto-generated by Apache Cordova
platform :ios, '8.0'
target 'niix' do
project 'niix.xcodeproj'
pod 'Intercom', '~> 3.2.2'
end
Podfile.lock:
PODS:
- Intercom (3.2.12)
DEPENDENCIES:
- Intercom (~> 3.2.2)
SPEC CHECKSUMS:
Intercom: 3119e8ebf76d3da425bab717a08067398fcabfe6
PODFILE CHECKSUM: f99283bb8a4e56cb037a02390d2fbc4e76c97db9
COCOAPODS: 1.3.1
There are no errors when running pod install, and all files I expect are present.
Things I have tried already:
Running pod install (of course)
Running pod deintegrate, running Product > Clean in XCode, re-running pod install
Manually deleting the Podfile.lock and Pods directory, running a Clean in XCode and then re-running pod install
A good nights sleep and another attempt the next morning!
Things to note:
I am running from project.xcworkspace not project.xcodeproj
I am running the latest stable version of XCode 8.3.3
I am running the latest version of Cocoapods 1.3.1
I've spent a long time trying to work this out and got nowhere. The app was built using Ionic 2, so the actual source code is stored elsewhere and built into a native XCode application.
Because of this I decided to delete the entire XCode directory. .xcodeproj, .xcworkspace, everything. I then rebuilt from Ionic.
On the second build I saw thats the Pods directory was there and everything was as it should be. I could compile and run first time without any issue.
My assumption is that the first build failed because I didn't have Cocoapods installed, so Ionic silently failed to run the pod install command upon set up. I guess it does something a little different to a traditional setup which is why I couldn't just run pod install afterwards.
So, in short, this was fixed by removing the iOS project:
ionic cordova platform rm ios
And re-adding it:
ionic cordova platform add ios
And then building:
ionic cordova run ios --device
But make sure you already have Cocoapods installed on your system first.

iOS carthage with MQTT framework

I have a application which is written in objective c and using pods to set dependency and target iOS version is 7.0. Due to some license conflict i want to use MQTT with dynamic linking with help of Carthage. So I followed following steps
Remove pod 'MQTTClient' from pod file and run the pod update.
It removed MQTTClient and keep others pods intact like afnetworking etc.
then I create Cartfile in project directory.
Add Github "ckrey/MQTT-Client-Framework" in Cartfile.
Run command carthage bootstrap --no-build --platform "iOS"
then run carthage build --no-skip-current --platform "iOS" gives always error Skipped building project due to the error:
Dependency "project" has no shared framework schemes for any
of the platforms: iOS
I have following question
Q1 As I understand, we can use both Carthage and cocoapod in same project.
Q2 how to resolve error mention in step6.
You can use Cocoapods and Carthage in the same project.
On step #6 make sure you are specifying the download as a 'binary'

Resources