How do I fix this flutter iOS error in Xcode? - ios

When I run the command "flutter build ios" - my app is built just fine. I can also run the app in the simulator. However, in Xcode, when I try to open the project, I get the error "unable to attach to DB: error: accessing build database"
This is the first time I've come across this problem on this app. Flutter doctor comes out clean, and nothing changes if I run "flutter clean" and build it again. I can't distribute my app until this is fixed.

That happens at times when the iOS build gets corrupted for some reason.
Close Xcode.
Run flutter clean
After that flutter build ios
Open Xcode again and run your app.
This should generally solve your issue.
If that does not work, you can try this:
flutter clean
cd ios
rm Podfile.lock
rm -rf Pods
pod deintegrate
pod cache clean
pod setup
pod install
After that run flutter build ios

This worked for me, after i run this command
rm -rf ~/Library/Developer/Xcode/DerivedData/
Then i rerun the app and it came to life.

Related

Xcode 13.4.1 error: unable to attach DB: error: accessing build database (react native)

**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 app.xcworkspace.
**error**: unable to attach DB: error: accessing build database "/Users/user/Library/Developer/Xcode/DerivedData/app-cdawdoxdzwfdgueqnyshuhonxndw/Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
tried almost everything
build cleans, reinstalling pods etc
react native version: 0.67.3
Xcode version: 13.4.1
After almost one day of debugging this issue, came to know about this article which solves the problem for me, although article has more than one steps but I just tried the last one and it worked, mentioning the steps below,
rm -rf ~/Library/Developer/Xcode/DerivedData/
cd ios
pod deintegrate
pod update
cd..
yarn run ios or npm run ios

Flutter iOS run on simulator fails: Undefined symbol: _OBJC_CLASS_$_EAAccessory

I have upgraded my Flutter code to Flutter 2.5 and since then there is an error each time I try to run the app on simulator. It runs fine on the real device, but on simulator I find this error:
I checked the libraries I use and all are added in the Build Phases.
Any help?
On your terminal, go to project's folder and go to ios folder then you can delete the podfile.lock, Pods folder, .symlinks folder.
Then run flutter clean, flutter pub get, and run pod install --repo-update.
Then open the project on XCode and click SHIFT + CMD + K to clean the build folder.
After that try running again and let me know if works.

flutter app runs on Android simulator but not iOS simulator

I am running a flutter app on the Android simulator successfully but when I run it on the iOS simulator the app opens to a white screen then crashes.
I have done all of the following about 10 times each.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
sudo xcodebuild -license
flutter update
flutter clean
xcode clean build folder
flutter build ios
flutter run
Remove the Pods folder and Podfile.lock files.
cd ios
pod deintegrate
cd ..
flutter clean
flutter build ios
Xcode 12.5.1
I also made sure Xcode Signing & Capabilities were set. I also stopped and removed all antivirus software.
It doesn't work by running debug and running via terminal ( flutter run --enable-software-rendering ) doesn't show any errors.
UPDATE:
Deleted the iOS folder and tried to run flutter create and now getting.
"No option specified for the output directory"
flutter create doesn't work.
Got the above flutter create working and now the app won't install on the Android device at all, where as it was working before flutter create was run (suggested below). Added memory and wiped Android simulator and still won't install on Android saying not enough memory. Deleting the ios folder and running "flutter create" was a disaster.
Rolling back to original code. Still stuck on not installing on iOS. It has to be something with Xcode.

Release build loads only the splash screen of the app in IOS Xcode Flutter

When in debug mode app works fine. But during the release build it loads only the splash screen. But when I tick debug executable in release mode.The app is working fine. Please guide. Sorry for the format.
Apple rejects my app
Guideline 2.1 - Performance - App Completeness
We discovered one or more bugs in your app when reviewed on iPad
running iOS 12.4 on Wi-Fi.
Specifically, your app only launched to a splash screen with no other
content available to the user.
Next Steps
To resolve this issue, please run your app on a device to identify any
issues, then revise and resubmit your app for review.
You should be write following command in terminal(Android Studio/Visual Code)
rm -rf $HOME/Library/Developer/Xcode/DerivedData/*
# destroy entire flutter cache (will be redownloaded and rebuilt)
# rm -rf $HOME/Library/Flutter/bin/cache/*
# sometimes Flutter doesn't recompile the frameworks
rm -rf ios/Flutter/App.framework ios/Flutter/Flutter.framework
# remove the entire pub-cache
rm -rf ~/.pub-cache/*
# now, remove the build directory
rm -rf build
# now remove the .packages file
rm -f .packages
# now remove the plugins directory
rm -rf .flutter-plugins
pushd ios
pod deintegrate
rm -rf Pods Podfile.lock
rm -rf .symlinks/*
popd
flutter packages get
Do clean of code by flutter clean
Install pods for iOS by
cd ios then pod install.
Then make release build for iOS by flutter build ios --release.
Now you can open iOS project in xcode and only splash screen issue will be fixed.
Same thing happened to me:
flutter clean
flutter build ios --release
Was all I needed (didn't need to do the pod install).
A few links that might also be helpful:
https://github.com/flutter/flutter/issues/22765#issuecomment-449618558
Flutter app opens, but is stuck on splash-screen
You need to build initially from Android studio for iOS.
Initially clean your project - flutter clean
Then run below line in terminal of Android studio.
flutter build ios --release
Now, open XCode and clean project then make your archive. Your issue of stuck in Splash is resolved.

Running react-native run-ios launches the app but close after splash, but via Xcode works perfectly

I am developing a React Native app. Since last week, I don't know why, I cannot run my app via react-native run-ios because the app just close after splash is shown.
Conversely, if I run the application from Xcode it works perfectly. In Android works perfectly too.
I need to run it via react-native run-ios to debug, someone have an idea what could be happening?
This problem has occurred after update my macOS from Sierra (not High Sierra) to Mojave.
EDIT: When this screen appear, it don't let a second to response, automatically the app close itself, and I cannot activate the debug mode to try see something in the console, the Node console of the server don't seems show anything weird, all is like it should be.
I've had similar errors, for me it was enough to re-run pod install, clean cache, restart simulator and temporarily disable the debugger.
1) Clean all the cache:
rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules && npm install && npm start -- --reset-cache
2) re-run pod install in the ios folder
3) restart the simulator or try to change the simulator:
react-native run-ios --simulator="iPhone 7"
4) After app starts installing on simulator immediately run a CMD+D and disable debugger
If you get any error with cocoaPods try re-installing them:
sudo gem install cocoapods
The error your are getting for cocoapods should be fixed with a simple re-install.
Update: I was able to replicate this on device, the only workaround to I found to load content was to disable the debugger and using console.warn to debug things. On simulator restarting JS server and disable&&enable the debugger seems to fix any issue.
I will update my answer if I will find a better solution.
I could reach to debug the app from Xcode changing schema from Release to Debug.
Anyway I could reach open it with the command react-native run-ios.
The steps to change schema are those:
Product -> Scheme -> Edit Scheme and select Debug instead of Release.

Resources