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

相关推荐
程序猿看视界1 小时前
如何在 UniApp 中实现 iOS 版本更新检测
ios·uniapp·版本更新
dr李四维5 小时前
iOS构建版本以及Hbuilder打iOS的ipa包全流程
前端·笔记·ios·产品运营·产品经理·xcode
旭日猎鹰5 小时前
Flutter踩坑记录(三)-- 更改入口执行文件
flutter
旭日猎鹰5 小时前
Flutter踩坑记录(一)debug运行生成的项目,不能手动点击运行
flutter
️ 邪神5 小时前
【Android、IOS、Flutter、鸿蒙、ReactNative 】自定义View
flutter·ios·鸿蒙·reactnative·anroid
比格丽巴格丽抱17 小时前
flutter项目苹果编译运行打包上线
flutter·ios
SoaringHeart17 小时前
Flutter进阶:基于 MLKit 的 OCR 文字识别
前端·flutter
网络安全-老纪18 小时前
iOS应用网络安全之HTTPS
web安全·ios·https
1024小神21 小时前
tauri2.0版本开发苹果ios和安卓android应用,环境搭建和最后编译为apk
android·ios·tauri
AiFlutter21 小时前
Flutter通过 Coap发送组播
flutter