After updating to Catalina 10.15.4 beta with Xcode 13.4 beta, which also updated Simulator to 13.4 (921.4).
The application compiles and runs correctly on a physically attached device, but no simulators of any devices can pass this stage.
I got the errors
Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator.
or
Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS.
How can I fix this?
Xcode 11.4 changed the way frameworks are linked and embedded, and you may experience issues switching between iOS devices and simulators. Flutter v1.15.3 and later will automatically migrate your Xcode project.
To get unstuck, follow the instructions below;
Quick fix (make your simulator work)
rm -rf ios/Flutter/App.framework
Official recommended Steps to migrate manually
From the Flutter app directory, open ios/Runner.xcworkspace in
Xcode.
In the Navigator pane, locate the Flutter group and remove App.framework and Flutter.framework.
In the Runner target build settings Build Phases > Link Binary With Libraries confirm App.framework and Flutter.framework are no longer present. Also confirm in Build Phases > Embed Frameworks.
Change the Runner target build settings Build Phases > Thin Binary script as follows:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"
embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh"
thin
In the Runner target Build Settings > Other Linker Flags
(OTHER_LDFLAGS) add $(inherited) -framework Flutter
Hope it helps!
Select your Target from "TARGETS"
Select 'Build Settings'
Under 'Build Options' -> Set 'Validate Workspace' To 'YES'
After successfully building, set it back to 'NO'
Reason :
"In Xcode 12+, the default option for Validate Workspace is internally not set. We need to set it manually to avoid this kind of error. There is no problem in setting back to the default 'NO' option.
Xcode 11.4 changed the way frameworks are linked and embedded, which is causing issues switching between iOS devices and simulators.
Please follow official guide on how to migrate your project.
After several days trying to find a solution to test the Flutter app on iOS device, I finally found this:
flutter clean
flutter build ios
-Open xCode and run app on your device.
Updated to Xcode 11.4. Ios 13.4, Iphone X. App just fetches data using API.
App started on white screen and then finally crashes, both on simulator and device.
I followed the offical guide (I also rm -rf ios/Flutter/App.framework)
flutter.dev/docs/development/ios-project-migration.
I ran several times flutter clean
I also tried deleting Pods/ folder and Podfile.lock, then reinstalling using pod install in the ios folder.
As I am using async data I also added as 1st line in main()
WidgetsFlutterBinding.ensureInitialized();
No help, app did not started either simulator.
Then I removed ios/ and android/ folders. After that in project folder I ran command flutter create . that regenerates mentioned folders.
After this my app started fine both on simulator and on device.
I hope this would be help to others. NOTE!! if you have done any modifications manually to those folders please take backup or commit beforehand.
I have tried the solution on the official website of flutter but it didn't work for me, so I found a temporary solution which worked for me, but it took me some hard works:
Here is my example with project stuck_framework which is a fresh new project (first time run on the simulator)
I created 2 folders inside flutter project called
"ios_simulator" and "ios_real_device".
enter image description here
Now my first build was for the simulator, then I want to switch to a real device, I will move ios folder inside Flutter project to the "ios_simulator"
I open the project with visual studio code and run "flutter create ." and now I will choose a real device to rebuild the project ( if your simulator is online, please quit ).
enter image description here
Now I wait for the build finish and run on the real device without any errors. Now I have 2 ios project 1 for simulators and one for real devices.
Next time when I want to run on the simulator again, I just remove the current ios folder and copy the ios folder which I placed on "ios_simulator" back out to flutter project folder. Hope this help
Manually upgrading flutter to version 1.15 solve this issue as well. Running flutter version v1.15.17 helped me.
Also, you can switch to beta or dev channels by running flutter channel command but be sure you check your code against all BC changes...
In my case, it works only simulator(debug). if you want to deploy your app on the app store(release) i highly recommend you to upgrade flutter version using
flutter version v1.15.17
otherwise you would encounter crashed app with white screen.
just upgrade flutter version then all things work well
This error is caused by the Xcode 11.4 and can be resolved by Removing / Re-Embedding frameworks and adding a new Run Script Phase.
Under General -> "Frameworks, Libraries, and Embedded Content"
Delete the frameworks that are causing errors.
After deleting, re-embed the frameworks in the same location.
Under Build Phases add a new run script phase.
Select the "+" button in the "Build Phases" pane to create a "New Run Script Phase".
Confirm the script is the bottommost build phase, and configure its fields.
The Shell text field should read /bin/sh (which is the default value).
In the text-input area, enter the shell command rm -r "FRAMEWORK_DIRECTORY/YOUR_FRAMEWORK.framework/"
None of the other solutions here worked for me. In my case, the problem was fixed by searching my project for ONLY_ACTIVE_ARCH and changing them all to YES. I found my solution here:
https://developer.apple.com/forums/thread/656509
I have a strange problem with the creation of ipa.
I have a web-app with an old ipa.
Now, I have the latest version of Xcode (7), I've tried to do a new ipa with the same files (of that web-app) and it doesn't work.
When I create the new ipa, I select "create for ad hoc deployment" and I don't send it immediately to app store.
I noticed that the new ipa is smaller than the old ipa.
I can install the web-app on my iphone and the app starts, but the jquery-mobile seems doesn't work.
Also, it seems that it can't do external calls (for example to a website).
If I install the old ipa, it works all.
I program the web-app with phonegap not with xcode.
I use xcode only to create the ipa.
Anyone know if there are problems with new version of Xcode?
I've tried the new ipa with iphone 6 and iphone 6 plus.
With apk for android works perfectly.
Thank you so much.
I've found the solution.
The external links were the problem.
In the new Xcode it's necessary to add a code in the config.xml that contain the external links that the web-app uses.
If I create a new Xcode project (just choosing, for example, the Single View Application template) then I cannot get Xcode to recognize the plugged in device.
As you can see from the screenshot my iPhone is called MyName's iPhone and is being recognized by an existing project; as you can see on the right Organizer can recognize it and it too and has displayed the green dot.
But as you can see in the middle the new created project does not recognize it and is displaying "iOS Device". When I try and execute the new project I get the "Xcode cannot run using the selected device" message.
I've tried exiting/relaunching Xcode, unplugging/replugging the device, tried re-creating new projects, but still the problem persists - any newly created project just won't recognize the device but all previously existing project do.
I had the same problem a few weeks ago and the solution then was to just delete the newly created project and create another one. But now I've tried that a few times and its no longer working as a solution.
XCode 5.1
The device has iOS 7.0.4. What is the new project's Deployment Target? If it's 7.1 then there is your problem. Change the Deployment Target to 7.0 or earlier.
So, in my first run-through creating my app, I hastily created a terrible file structure that annoyed me, so I decided to create a new version of the same app, and start from scratch using some of the same old stuff in new files. When I build the new app in the iPad simulator, the simulator runs the old app even though I have deleted all references to the old project file and folder.
Not sure what I can do to make it run the new version of my app instead of the old one. Any suggestions?
iPad simulator runs an old version of an app that I recreated instead of the new version on build
Just remove the old App in simulator / Reset Contents & Settings via the Simulator menu.
You should not only remove your old app from simulator, but also if you are building a new one on an old project file/workspace, open Xcode's Organizer -> Projects, find your project and delete it, make Clean on your project, then close Xcode and reopen it. That'll make sure you get clean and complete rebuild.
An hour ago everything worked great. I was busy hacking away at my code, deploying it to the simulator or my iPad as I liked, and no problems. Then I thought all the bugs were gone, so I created a new Provisioning Profile for the app and added it to the "Release" Project Settings. Suddenly, I cannot launch the app on my iPad anymore, and the only thing that XCode tells me is "Failed to upload MyApp.app"... no elaboration at all.
I'm still using the Developer Profile (which the organizer assures me is installed on my iPad) for the "Debug" Project Settings.
I tried deleting the most recent version from my iPad, deleting the Build/ directory, and then installing but no joy.
Help, please!
I'd try removing your provisioning profiles, even going through and manually editing your project file such as described: Code Sign error: The identity 'iPhone Developer: x Xxxxx' doesn't match any identity in any profile
Then reinstall the profiles. Anytime I've had an issue like you're describing that has solved the problem for me.