flutter 导出iOS问题2

问题1:The Swift pod FirebaseCoreInternal depends upon GoogleUtilities, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries)
参考

c 复制代码
正如上图报错第三方库The Swift pod FirebaseCoreInternal depends upon GoogleUtilities,那么就在FirebaseCoreInternal和GoogleUtilities添加上:modular_headers => true即可
在你的ios项目文件夹中找到Podfile文件,找到target配置
例:
pod 'FirebaseCoreInternal','9.2.0', :modular_headers => true
pod 'GoogleUtilities','7.7.0', :modular_headers => true

问题2:! 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).
参考

! CocoaPods没有设置项目的基本配置,因为您的项目已经有一个自定义配置集。为了让CocoaPods集成工作,请将目标"Runner"的基本配置设置为"target Support Files/Pods Runner/Pods-Runner.profile"。xcconfig或包含"Target Support Files/Pods Runner/Pods-Runner.profile"。xcconfig在构建配置中(Flutter/Release.xcconf)。

Release.xcconfig 添加:

c 复制代码
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
#include "Generated.xcconfig"

Debug.xcconfig 添加:

c 复制代码
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"

再次 pod install

pod instal

c 复制代码
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 27 dependencies from the Podfile and 35 total pods installed.

问题3

Compiling for iOS xxx, but module 'xxx' 'has a minimum deployment target of iOS xxx 错误的解决方案
参考

错误原因:

iphone或者iPad设置最低运行的版本是ios10.0,但是使用的第三方库,最低运行是 ios12.0,因为第三方库最低要求比iPhone或者iPad高,所以运行报错。

解决方案:

1.查看iphone iPad Target的最低ios版本

我的iphone iPad设置的target运行版本是iOS 10.0, 查看界面如下,选中自己项目,targets,然后General → Deployment Info → ios 设置了10.0,现在需要把pod里面的第三方库也设置成10.0或者以下

2.修改pod里第三方库的target 版本

点击左边目录的Pods,选择 Targets →选中报错的第三方库→ Deployment->IOS Deployment Target 把之前的12.0改成10.0,找不到的话就在搜索框搜索即可。如下图:

因为xcode 12就开始默认把所有第三方库都设置成iOS12.0,所以按住shift选中左边所有第三方库,然后再选择12.0,如下图:

再编译就编译成功了。

问题4:'flutter_vibrate/flutter_vibrate-Swift.h' file not found

把项目的插件注释掉

转到Ios / Podfile添加以下行:

c 复制代码
platform :ios, '12.0'
use_frameworks!

target 'Runner' do
  use_frameworks!
end

Framework:实际上是一种打包方式,将库的二进制文件,头文件和有关的资源文件打包到一起,方便管理和分发。

CocoaPods 通过use_frameworks来控制是否是用Framework。

如果不使用use_frameworks!则会使用static libraries 方式生成.a文件。

如果使用use_frameworks!则会使用dynamic frameworks 方式生成.framework文件。

在纯oc的项目中,一般不使用frameworks,但是在pod导入的swift项目,必须要使用use_frameworks!,我这个flutter项目也是用pod导入的第三方库,所以必须加入use_frameworks

然后进行

flutter clean清理

删除Podfile.lock文件重新运行

执行pod install安装等等

平时flutter项目中遇到问题,我们用的最多的方法就是:

1、flutter clean清理;

2、Android Studio中File--Invalidate Caches / Restart--Invalidate and Restart清理、或AS重启;

3、xcode中的Command+Shift+K清理;

4、重新插拔手机;

5、重新启动手机;

6、重启电脑;

7、重启xcode;

8、删除Podfile.lock文件重新运行;

9、执行pod install安装等等

faceBook填写数据

右键info,用code打开

c 复制代码
Configure iOS 
Read through the "Getting Started with App Events for iOS" tutorial and in particular, follow step 5 by opening info.plist "As Source Code" and add the following

If your code does not have CFBundleURLTypes, add the following just before the final </dict> element:
<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>fb[APP_ID]</string>
  </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookClientToken</key>
<string>[CLIENT_TOKEN]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>

If your code already contains CFBundleURLTypes, insert the following:
<array>
 <dict>
 <key>CFBundleURLSchemes</key>
 <array>
   <string>fb[APP_ID]</string>
 </array>
 </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookClientToken</key>
<string>[CLIENT_TOKEN]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>

问题5:File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
参考

c 复制代码
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end
    end
  end

  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end





问题6:

Failed to connect to developers.facebook.com port 443 after 75013 ms: Couldn't connect to server,有个库无法从服务器上拉下来,安装不了
参考

问题7:两个版本库调用同一个不同版本的库,其中一个降低版本
参考

c 复制代码
问题描述
Flutter的项目中引入了极光的两个插件jpush_flutter和jverify使用的核心模块JCore版本不一致,导致合并Podfile出现问题:
AdministratordeMacBook-Air:ios administrator$ pod install
/Users/administrator/VSCodeProjects/kiss_you_new/ios/Podfile:41: warning: ... at EOL, should be parenthesized?
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "JCore":
  In Podfile:
    jpush_flutter (from `.symlinks/plugins/jpush_flutter/ios`) was resolved to 0.0.2, which depends on
      JCore (= 2.7.1)

    jverify (from `.symlinks/plugins/jverify/ios`) was resolved to 0.0.1, which depends on
      JCore (= 2.6.2)

    jverify (from `.symlinks/plugins/jverify/ios`) was resolved to 0.0.1, which depends on
      JVerification (= 2.7.5) was resolved to 2.7.5, which depends on
        JCore (< 6.0.0, >= 2.1.6)
c 复制代码
解决
将jpush_flutter的JCore模块降级版本:

点开ios目录下.symlinks/plugins,打开jpush_flutter/ios/jpush_flutter.podspec文件,修改如下两行:
  s.version          = '0.0.1'

  s.dependency 'JCore','2.6.2'

总结

由于jverify插件的JCore版本版本和jpush_flutter的JCore版本不一致,后续可以适当降低jpush_flutter和jverify版本,待我后续有空,将匹配的版本列出来,这样就不需要修改podspec文件了。

出现两个库用同一库,且不通版本,即有冲突,可以手动调整版本,让那个被调用的库版本一致。

问题7:

! Error installing FBAudienceNetwork

curl: (28) Failed to connect to developers.facebook.com port 443 after 75001 ms: Couldn't connect to server

1.开启代理,在网络设置里面获取代理的IP和端口号

2.在终端上输入进入iOS的文件夹cd

3.配置终端临时代理,终端上输入

c 复制代码
export https_proxy=socks://127.0.0.1:29878

我先配了export http_proxy="http://127.0.0.1:29879",还是拉不下来,然后又配了git config --global http.proxy 'socks5://127.0.0.1:29879'也不行,最后配了export https_proxy=socks://127.0.0.1:29878就可以了
参考

注意: curl developers.facebook.com照样没反应
4.配置host文件

c 复制代码
157.240.18.15 developers.facebook.com

具体IP以自己查的为准,首先打开链接 ipaddress.com 查找 developers.facebook.com的域名(我这里的IP直接用别人的)

5.pod install

相关推荐
用户965597361901 天前
Provider vs Bloc vs GetX vs Riverpod:Flutter 状态管理方案怎么选?
flutter
恋猫de小郭1 天前
Flutter Patchwork,不用 Fork 改依赖包源码的第三方工具
android·前端·flutter
程序员老刘2 天前
跑分第一的编程大模型,我为啥不用?
flutter·ai编程·vibecoding
恋猫de小郭2 天前
苹果 AirPods 协议,Android 也可以使用完整版 AirPods 能力
android·前端·flutter
张风捷特烈2 天前
Flutter 类库大揭秘#01 | path_provider架构与设计
android·flutter
壹方秘境4 天前
我用Go语言开发了一个跨平台的HTTPS抓包和调试工具
前端·后端·ios
恋猫de小郭5 天前
Android 限制侧载新进展,谷歌联合国内厂商推验证计划
android·前端·flutter
恋猫de小郭5 天前
解读 Android 17 全新内存限制,有没有“豁免”后门?
android·前端·flutter
程序员老刘7 天前
跨平台开发地图 | 2026年6月
flutter·ai编程·客户端
悟空瞎说8 天前
Flutter 架构详解:新手必懂底层原理
flutter