Build Failed for flutter project in Xcode - xcode

Facing this issue when opening flutter project in Xcode
/Users/user/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.2/ios/Classes/webview-umbrella.h: No such file or directory (in target 'webview_flutter_wkwebview' from project 'Pods')

Please try these steps
Delete podfile.lock (Do NOT delete PodFile)
Delete .symlinks folder
Delete pods folder
Navigate to ios directory in terminal and run pod install
Open the xcworkspace file in xcode
Select product -> clean build folder
Run the project from xcode once. All subsequent builds should work in your ide

Related

shared preferences don't work on ios [Xcode Debug]

I am trying to save the data locally in my application trying to use the shared preferences, while on android and chrome everything is ok, on ios by problems. When I debug with xcode this warning comes out "shared_preferences_ios not found".
Follow this steps
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run

How do I archive Xcode project?

I am currently having issues when attempting to archive my project in Xcode. The following error below appears when archiving:
The link Xcode 12 Error: Multiple commands produce AccessibilityResources.bundle mentions to remove React-Core.common-AccessibilityResources from my target but I do not have this under my target. Can someone please assist?
I am using Xcode version 12.1.
This is what I have in the workspace settings:
Thank you.
I changed the derived data location but still getting the same error:
I am now seeing the below error after updating my Podfile.
Current error:
Updated Podfile:
Have a try with the below solution.
Initially clean the build cache data with the below steps:
You can go to File > Workspace Settings if you are in a workspace environment or File > Project Settings for a regular project environment.
Then click over the little grey arrow under the Derived data section and select your project folder and close the workspace and Xcode then delete the project directory from the derived data directory.
Open the workspace again in Xcode and clean and rebuild the project.
Also, make sure that you have applied pod install after the package installation.
Then, open workspace and set the active scheme as Any ios Device (arm64, armv7)
Click on Project from top Xcode Menu
Then select Archive.
Have a break till the Archive process completes.
Remove the below lines from PodFile:
use_flipper!()
post_install do |installer|
flipper_post_install(installer)
end
and do pod install in ios directory.

Unable to open Runner.xwworkspace file from project directory

While opening runner.xwworkspace from flutter project ios directory I am getting an error file does not exist.
Also while building it from xcode i am getting error ==> /bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Did you change anything in your iOS project? If not then I can recommend recreating the iOS project by running flutter create again e.g.:
Go to the root of your project and remove ios directory and then recreate the project:
rm -rf ./ios
flutter create .
Check also the output from flutter doctor.

ERROR: main.jsbundle does not exist - React Native 0.60.4

I'm trying to publish my first React Native app in App store and when I'll build in Xcode:
Product > Archive
appears some error, but i already have main.jsbundle
main.jsbundle does not exist. This must be a bug with
echo 'React Native
Screen Error:
You can generate a new main.jsbundle using this command.
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Run this command in your project directory.
In my case, I was able to fix the issue by removing main.jsbundle from Bundle Resources.
Open react native project in xcode
Check if Copy Bundle Resources build phase contains main.jsbundle
If it contains, remove it and build again
Clear watchman watches:
watchman watch-del-all
Delete node_modules:
rm -rf node_modules and run yarn install
Reset Metro's cache:
yarn start --reset-cache
Remove the cache:
rm -rf /tmp/metro-*
In Xcode, you should be able to find the main.jsbundle inside the Xcode project sidebar.
If it isn't there, then you should drag the main.jsbundle into your Xcode project (in the default template app you can find it at ios/main.jsbundle)
If it is in there, but red - then you need to build a copy of the main.jsbundle which you can do via react-native bundle (and some additional args which you can look up.
I was getting the error because of a bug in the code, instead of using simulator I was using Xcode to install a release build to my device which led to this error.
To fix this, run the app on the simulator make sure it builds and runs properly and then install it on your device.
Try this instead
Go to Xcode
Go to targets
Select Build phases from the top
Just remove main.jsbundle lib from Copy Bundle Resources in build phase
re-run again.

Xcode 7.2 successful archives will not show in organizer, but will show in archives folder about derived data folder

I am using Cocoapods 0.39.0 and Xcode 7.2, I have a project that archives successfully but does not populate in organizer. When I tested my podfile in a blank project the archive showed up in the Organizer just fine.
While trying to troubleshoot this I found that there was an Archives folder above Derived Data. There I actually found all the .xcarchive files of the project that won't show up in the Organizer.
When clicking on the file details, I also noticed that the working Archive had a size (228.3 MB for the test project) but my main project I want working has a size of 0 bytes.
Figured it out.
Searched Installation Directory in Build Settings
Removed #executable_path/../Frameworks as the value for Installation Directory
Typed the following for the Installation Directory $(LOCAL_APPS_DIR)
Reference: "Xcode successfully archived my application, but the Archives Organizer does not list my archive" section https://developer.apple.com/library/ios/technotes/tn2215/_index.html
In XCode Project\Targets\Build Settings make sure
Skip Install = NO
for your Archive scheme, if you created one, or Release scheme
In my case (Xcode 8.3.3), the Installation Directory was pointing to /Applications which seemed correct, so that wasn't the issue. What worked was:
1. restart Xcode
2. Product ➞ Clean
3. delete the whole 'Derived Data' folder (to see where it is: Xcode ➞ Preferences... ➞ Locations ➞ Derived Data)
4. Product ➞ Clean
I had the same problem when I created debug build pointing to our QA environment.
Debug build was just Zero byte.
As #kareem mention above I figure that release/distributio build are having path as /Applications.
I just duplicated for my debug build and bingo !!!
Yes you can add /Application instead of current value which was '#executable_path/../Frameworks'
This way if you archive your debug build, you will have actual archive just like release build
All credit goes to kareem. I just try to enhanced by adding another prespective.
Easiest step that worked for me.
Delete folder Derived Data (to see where it is: Xcode ➞ Preferences... ➞ Locations ➞ Derived Data)
Generate the archive, select the Xcode ➞ Product ➞ Archive
Once the process is complete the archive will be displayed in the Archive screen of the Organizer dialog.
I was also facing the same issue in Xcode 12.4 then I tried with the method #kareem said.
But after that as well was not resolved.
One of the pod framework in my project is enabled for the App Extension as well. So I removed it from pod and installed using Swift Package Manager.
This resolved my issue.
Afterward I tried another way:
Also I modified the podfile like below and reintal and it worked:
target 'ProjectName'
do
use_frameworks!
. . .
target 'ProjectNameBroadcast'
do
inherit! :search_paths
end
target 'ProjectNameBroadcastSetupUI'
do
inherit! :search_paths
end
end
1. Clean
2. Build
Worked for me.

Resources