iOS,ld:找不到架构arm64的GoogleMaps框架

问题描述 投票:0回答:4

我正在使用谷歌地图开发一个应用程序。我会解释我用谷歌地图做了什么,也许你可以帮助我。

我在没有 POD 的情况下使用 Google 地图框架,但在出现一些关于 Google 地图密钥的错误后,我删除了 google 地图框架参考,并使用 POD 安装了它。一切都工作正常,但是当我点击

产品 -> 测试

现在我收到此错误:

ld: framework not found GoogleMaps for architecture arm64

知道如何解决这个问题吗?

谢谢!

Podfile 看起来像这个 Cocoapods v1.0 beta 6):

platform :ios, '8.0'
use_frameworks!

target 'Project' do
    pod 'GoogleMaps'

    target 'ProjectTests' do
        inherit! :search_paths
        pod 'Mockingjay'
    end
end
ios swift google-maps cocoapods xcode7
4个回答
2
投票

更新 请检查目标的

Architectures
Build active Architectures only
键中是否具有相同的构建设置

你的 podfile 应该是这样的

platform :ios, '8.0'
use_frameworks!

target 'Project' do
    pod 'GoogleMaps'
end

target 'ProjectTests' do
     //inherit! :search_paths
     pod 'Mockingjay'
end

在开始

project
目标之前结束
ProjectTest
目标,还有为什么要添加
inherit! :search_paths
?除非您有特殊要求,否则通常不需要


旧答案

如果您想在测试目标中添加 pod,则必须在测试中添加,就像您在项目的主目标中添加的方式一样

如果“SwiftCocoaPods”是您的主要目标名称,那么您的可可豆荚就像这样

//other top level imports
target “SwiftCocoaPods” do
pod "GoogleMaps"
end

target “SwiftCocoaPodsTests” do
pod "GoogleMaps"
end

然后您应该添加用于测试的 pod,例如“SwiftCocoaPodsTests”。您可以将名称替换为您的测试目标名称

否则,如果您想在多个目标中添加相同的 pod,您可以使用

def
并在所有目标中使用它,如下所示

def project_pods
pod "GoogleMaps"
//add other pods which you want in all the targets
end

target “SwiftCocoaPods” do
project_pods 
end

//only add project_pods instead of pods individually 
target “SwiftCocoaPodsTests” do
project_pods
end

0
投票

这对我有用:

platform :ios, '9.0'

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

def all_pods
    pod 'GoogleMaps'
end

abstract_target 'Map Base' do
     all_pods

     target 'Map' do

     end

     target 'Unit Tests' do

     end

     target 'Device Tests' do

     end
end

0
投票

您可以按照https://github.com/googlemaps/google-maps-ios-utils/issues/355#issuecomment-800912985

中的建议使用Rosetta打开Xcode来尝试此解决方法

它会影响你的表现,但有效。

1 - With Xcode closed (Important) Go to finder -> Applications
2 - Right Click on Xcode and select "Get Info"
3 - On the info panel check "Open using Rosetta"
4 - Double Click in the large bottom preview of the info panel.

看到这条评论: https://github.com/googlemaps/google-maps-ios-utils/issues/355#issuecomment-1060959728


-1
投票

适用于 Xcode 14.3 + 请按照此在 Xcode 14.3+ 中使用 Rosetta 打开

要在 Rosetta 模拟器上运行应用程序,您需要执行以下操作。

  1. 转到菜单栏中的“产品”菜单,然后选择目标 > 目标架构 > 显示 Rosetta 目标。
  2. 您将在模拟器旁边的括号中看到架构。在这种情况下,它是罗塞塔。

您将在模拟器名称旁边的括号中看到 Rosetta 架构。 如果您想在两种架构上运行,请选择“显示两者”选项。

  • 转到菜单栏中的“产品”菜单,然后选择“目标”>“目标架构”>“显示两者”。

参考:https://sarunw.com/posts/open-using-rosetta-in-xcode-14-3/

© www.soinside.com 2019 - 2024. All rights reserved.