Unable to build iOS after renaming Xcode project flutter - ios

I have an issue guys. For some reason, I decided to rename my Xcode project runner folder before sending to the apple store. Now I wanted to rebuild for iOS with this command: flutter build ios. But I get this error each time:
Expected ios/Runner.xcodeproj but this file is missing.
Application not configured for iOS
I also tried building this with Xcode. I got this error each time:
/Users/apple/FlutterProjects/kashbase/ios/Pods/Target Support Files/Pods-Kashbase/Pods-Kashbase.debug.xcconfig: unable to open file (in target "Kashbase" in project "Kashbase") (in target 'Kashbase')
What does this mean and how can resolve this? Any helpful effort will be greatly appreciated.

Related

XCode 12.5 w/ MacOS 11.3 - Fails to Archive: Illegal Instruction: 4

This question has been asked a few times in the past, but none of those answers seem to match what is currently going on.
I have an app (SwiftUI) that builds, runs, tests fine on simulators and devices. But when attempting to Archive for iOS and/or MacOS, the archiving fails with a vague error "Illegal instruction: 4". The compiler then lists a bunch of files and directories which offer no help.
ERROR MESSAGE SNIPPET:
CompileSwift normal arm64 (in target 'App Name' from project 'App Name')
...Lists a bunch of directories
error: Illegal instruction: 4 (in target 'App Name' from project 'App Name')
The weird thing is that prior to the XCode and MacOS update, this app will Archive fine. So I am left to assume something was deprecated in this latest release.
My question is: What are some debugging tools to help me start to find where in my code this may be happening? Why would the app build and run fine on simulators and devices but not Archive? makes no sense to me.
I did test this by attempting to Archive on another MacBook with MacOS 11.0.1 and XCode 12.2, and it Archives fine.. Although, this is really useless since you cant upload a binary compiled with an older version of XCode.. *I was able to upload the binary using the older Xcode version, not sure if it will let me release this, but I will try that for now.
I have considered deleting and reinstalling XCode, but I don't know if that would be a waste of time. Maybe something didn't update properly?
At a loss. Any insight is appreciated.
update
When I edit the scheme and change Archive from Release to Debug, it Archive's?!
What am I missing?
2nd update:
When changing the build settings, under the Project, Swift Compilier, Code Generation, Optimization level from Optimize for Speed -O to No Optimization -Onone, the app Archives with no issues.

Why does xCode cannot build my flutter app with 'sqflite' not found error

I'm trying to build my Flutter app for iOS using xCode and got error:
.../ios/Runner/GeneratedPluginRegistrant.m:10:9: Module 'sqflite' not found
When I'm trying to build application with flutter with command
flutter build ios
I don't have any problem. Application build successfully.
I tried to delete Pod directory in ios folder and then install pods from scratch
flutter pub get
pod install
How to fix this problem with xCode?
XCode gives this type of Error like Module 'something' not found, when sometimes the problem is somewhere else.
So, what I did is after running flutter build ios command, I didn't try to run it in XCode. Because it was giving these errors.
So, I archived the app and tried to publish in App Store Connect. Then I found the real issue/bug on my code.
App store doesn't support transparent logo or app icon. This was the bug in my case.
So you can try to archive and publish to app store connect. It may show you the real reason.
Change your target Destination to > Any iOS Device
This work for me
"I found the solution,
In the existing project, once you guys add sqflite dependencies
Profile file in IOS folder will not generate code
we need to remove Podfile in ios
rm ios/Podfile
and run the project again, it works for me."
Credit:thanks to viroth-geek

Xcode 11.4 archive fails when building target dependency

I have a framework project which gets build using a shell script under Build Phase. It uses xcodebuild to do that.
Since I have updated the Xcode to 11.4, I am getting the following error when the consuming project tries to build the dependency for above framework( The same works fine when I build the framework on it's own).
unable to create directory '/Users/.../Library/Developer/Xcode/DerivedData/App-cnatioifembsmzdvoyyuogceigiw/Build/Intermediates.noindex/ArchiveIntermediates/AppName-Staging/BuildProductsPath/Debug-iphoneos/FrameworkName.framework' (in target 'TargetName' from project 'ProjectName')
I have checked the write permission on the directory. I have given full hard disk access to Xcode under Security and Privacy but it is still happening.
Any guidance will be appreciated.
Thanks in advance.

Unable to build app for iOS, "unable to write module session file Session.modulevalidation No such file or directory"

yesterday I was working fine with Flutter, now i'm facing this issue and I already search everywhere for a solution but no success.
When I run:
flutter run
The build process starts and when its about to finish the error below is shown:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 12.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to write module session file at '/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation': fopen(/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation, wb): No such file or directory (2)
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)
Looks like the process is trying to open this file Session.modulevalidation for writing, but this file really does not exist in that folder. And I don't know what to do.
Things that I already tried:
Reinstalling xcode
flutter clean
Clone my project again in another folder and try to build, but same error
Created a new flutter dummy project and tried to build, still same error
Rebooting machine several times
Give permissions to Staff to the DerivedData and ModuleCache.noindex folders
Deleted the DerivedData within hope that xcode build will recreate all the files needed, but, it created everything again but not that particular file.
So that's it, If any blessed human know how to 'recreate', or reset, clear some cache, I would be very thankful.
Before running your project, check everything is checked when running:
flutter doctor
and also make sure at least a device is connected or open iOS simulator first. You can check if flutter is successfully connected to the device by:
flutter devices
when you make sure that flutter detect your device or the simulator, then run your application by:
flutter run
After hours I finally found the solution as it follows:
Without any hope I opened my flutter project with Xcode, and then tried to build the Runner target from there, same error.
Then, I was browsing the Xcode preferences and something caught my attention, on Locations section I found something about DerivedData location, it was set as Default. So, I changed from Default to Custom location and I set to a new folder on my home directory:
Then immediately Xcode created the entire DerivedData/ModuleCache.noindex folder and with them, the Session.modulevalidation file as well.
Then I closed Xcode and tried flutter run again, and it was successfully build!
I'll let this answer to those who may come here for help.

Flutter, Cannot Build For iOS: Missing .h-Files

Building our Flutter project fails on iOS. The following steps work without problems:
running on the XCode simulator (flutter run)
building in the terminal (flutter build ios)
running on a real device in debug mode (flutter run -d "abcd")
If I open the project in XCode, change the build target to "Generic iOS Device" and hit "Build" or "Archive" I get the following error:
/Users/.../development/testproject/ios/Runner/GeneratedPluginRegistrant.m:6:9: 'flutter_exif_rotation/FlutterExifRotationPlugin.h' file not found
After removing the FlutterExifRotationPlugin, the error reoccurs with the next plugin alphabetically, so I figured that plugins in general don't work at the moment.
I tried:
dev, stable and master channels of flutter
reinstalling XCode
reinstalling Flutter
create a new project and moving the old files there
But nothing worked so far.
Ok the solution was very simple. I had to open the .xcworkspace file instead of the .xcodeproject one.
One WEEK went down the pipe for this error. I hope that you, future reader, will find this comment useful.

Resources