gpt4 book ai didi

Swift 和谷歌地图 SDK。与桥接头混淆

转载 作者:搜寻专家 更新时间:2023-11-01 05:43:21 24 4
gpt4 key购买 nike

我是 iOS 开发的新手,正在尝试使用 Swift 来使用 Google Maps SDK。根据文档,我必须执行以下操作才能将 Objectiv-C 库导入 Swift 项目:

Under Build Settings, make sure the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header. The path must be directly to the file itself, not the directory that it’s in.

https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/buildingcocoaapps/MixandMatch.html

提到的设置如下所示:http://image.bayimg.com/f0674c9d6da65a0b8b2aada4ead273635625e83e.jpg

我应该在哪里添加我想使用的标题的路径?

最佳答案

(在问题编辑中回答。转换为社区维基答案。参见 What is the appropriate action when the answer to a question is added to the question itself?)

OP 写道:

Problem solved thanks to Anil's comment. I misunderstood the docs. Xcode creates a Header-File named ProjectName-Bridging-Header.h in the project, and the ObjectiveC Libraries can be imported there. In my case it looks like this:

//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <GoogleMaps/GoogleMaps.h>

After that, functions from GoogleMaps/GoogleMaps.h can be accessed in every Swift class.

关于Swift 和谷歌地图 SDK。与桥接头混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24285199/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com