flutter 解析问题(Xcode):未找到模块“pay2.0”(位于项目“Pods”的目标“pay2.0”中)

6l7fqoea  于 2023-01-21  发布在  Flutter
关注(0)|答案(5)|浏览(182)
Parse Issue (Xcode): Module 'fluttertoast' not found
/Users/anand/StudioProjects/untitled/ios/Runner/GeneratedPluginRegistrant.m:11:8

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.

我捕获这个错误几乎24小时。请帮助别人,我使用的fluttertoast: ^8.0.9库最大的地方在我的项目,如果我删除库项目照常运行,但如果我添加库上述错误抛出。我不知道如何摆脱错误。我尝试了大部分的答案在堆栈溢出。

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  
  @override
  Widget build(BuildContext context) {
  
    return Scaffold(
      appBar: AppBar(
        
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Hello flutter',
            ),
            
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: (){
          Fluttertoast.showToast(
              msg: "This is Center Short Toast",
              toastLength: Toast.LENGTH_SHORT,
              gravity: ToastGravity.CENTER,
              timeInSecForIosWeb: 1,
              backgroundColor: Colors.red,
              textColor: Colors.white,
              fontSize: 16.0
          );
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

请帮助我怎样消除这个错误。

x0fgdtte

x0fgdtte1#

试试这个,对我很有效!

pod repo update
pod install
ev7lccsx

ev7lccsx2#

尝试步骤:
1.删除IOS文件夹中的**“podfile”“podfile. Lock”**文件
1.终端执行:在IOS文件目录中执行flutter clean
1.在Android studio的. Yaml文件中执行flutter pub get
1.终端执行:在IOS目录中执行pod install

l5tcr1uw

l5tcr1uw3#

尝试安装cocoapod,它是swift和objective c的依赖管理器,然后运行命令

pod deintegrate
pod install

在Flutter项目的iOS文件夹中。这应该是相同的任何flutter插件,我们将在该项目中设置。请检查此链接以及macos-deploy-to-ios-devices

c6ubokkw

c6ubokkw4#

我也面临着同样的问题,首先我运行了清洁:

➜  flutter-netease-music git:(master) ✗ ~/fvm/versions/3.0.5/bin/flutter clean
Cleaning Xcode workspace...                                      1,609ms
Cleaning Xcode workspace...                                      1,957ms
Deleting build...                                                   15ms
Deleting .dart_tool...                                               1ms
Deleting .packages...                                                0ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting Flutter.podspec...                                          0ms
Deleting ephemeral...                                                0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms

然后运行酒吧get:

~/fvm/versions/3.0.5/bin/flutter pub get

下一步,运行以下命令:

pod repo update
pod install

从日志输出中,我们可以找到pod安装的fluttertoast依赖项:

➜  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`).

然后在xcode success中构建项目。

nfzehxib

nfzehxib5#

首先,试试这个:
1.进入ios文件夹
1.删除Podfile.lock文件

  1. rm -rf Pods
  2. pod cache clean --all
  3. pod deintegrate
  4. pod setup
  5. pod install
  6. pod upgrade
    如果这不起作用,请尝试:
    1.通过VSCode打开项目
    1.检查ios > Pods文件夹中的Toast文件夹。
    1.如果该文件夹存在,请通过VSCode运行flutter build ios
    1.如果生成成功,请尝试在XCode上运行该项目。
    这对我很有效!

相关问题