'Flutter Error on Real iOS Device: "module 'fluttertoast' not found"
My flutter app is working properly in iOS Simulator.
I have added fluttertoast by:
Adding it on pubspec.yaml
dependencies: flutter: sdk: flutter
cupertino_icons: ^0.1.3
fluttertoast: ^7.0.1
Importing in my dart file
import 'package:fluttertoast/fluttertoast.dart';
So far it works as intended. BUT, when I move to a REAL iOS device, my iPhone XS, It won't compile. I get this error:
fatal error: module 'fluttertoast' not found @import fluttertoast;
What am I missing?
Solution 1:[1]
Suprisingly, I made it work just now.
What I did:
- Tried to modified the podfile.
- Tried to run it. Error due to podfile.
- Revert podfile to original state.
- Tried to build, pop-up asking something like 'would you like to use Xcode version or version on disk (I used Xcode version before which may have caused the problem)
- I chose to use VERSION ON DISK.
- Program is now working on real iOS device.
So whenever you get the pop-up asking "which version to use", always choose "VERSION ON DISK".
Thanks guys
Solution 2:[2]
I have face this issue very recently and the way I fix is like this. I change the pod file min deployment to 11 as needed by some of the pacakges I was using like flutter stripe. but the issue was that in Xcode the deployment was set to 9.0(not changing to 11.0). which was causing the issue to fix the issue follow the step.
1 : delete to /iOS/podfile.lock (if any)
2 : go to /iOS/podfile (platform :ios, '9.0') replace the 9.0 with version required for your packages/app.
3 : in terminal cd ios (pod install)
4 : edit the deployment info version here as well in Xcode
5 : run the app it will work if building archive build archive it will not throw the error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | noogui |
Solution 2 | Zakria Khan |