Reputation: 17613
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?
Upvotes: 6
Views: 12940
Reputation: 1
Instead of opening Runner.xcodeproj you have to open Runner.xcworkspace then it will work
Upvotes: 0
Reputation: 1493
This worked for me
Open -> ios -> Podfile
Un-comment the line
#platform :ios, '11.0'
//to
platform :ios, '11.0'
Upvotes: 1
Reputation: 41
Upvotes: 1
Reputation: 38763
Today I am facing the same problem, what I do is switch to the project ios folder, run this command:
pod repo update
pod install
from the log output, we can found the pod install the fluttertoast
dependencies:
➜ ios git:(master) ✗ pod install
Analyzing dependencies
Downloading dependencies
Installing FMDB (2.7.5)
Installing Flutter (1.0.0)
Installing SwiftAudioEx (0.14.7)
Installing Toast (4.0.0)
Installing device_info_plus (0.0.1)
Installing flutter_secure_storage (3.3.1)
Installing fluttertoast (0.0.2)
Installing in_app_purchase_ios (0.0.1)
Installing music_player (0.0.1)
Installing path_provider_ios (0.0.1)
Installing shared_preferences_ios (0.0.1)
Installing sqflite (0.0.2)
Installing system_clock (0.0.1)
Installing url_launcher_ios (0.0.1)
Installing video_player_avfoundation (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 12 dependencies from the Podfile and 15 total pods installed.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
then build the project in xcode success.
Upvotes: 1
Reputation: 2186
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.
Upvotes: 5
Reputation: 17613
Suprisingly, I made it work just now.
What I did:
So whenever you get the pop-up asking "which version to use", always choose "VERSION ON DISK".
Thanks guys
Upvotes: 6