问题标签 [objc-bridging-header]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
809 浏览

ios - 尝试将 Linkedin SDK 集成到我的 Swift 项目中时出错

我正在尝试将 Linkedin SDK 集成到我的 Swift 项目中。我正在使用这个 cocoapod,这是我得到的错误。

使用未解析的标识符“LinkedinSwiftHelper”

我的播客文件:

使用_frameworks!

目标 'JobRewards' 做 pod 'LinkedinSwift', '~> 1.6.5'

结尾

这是我得到错误的那一行,我在我的视图控制器的类声明之后声明了这一点:

我的桥接头:

我的 info.plist 源代码:

在构建设置/Objective-C 桥接头上,这是当前路径:

在此先感谢您的帮助,我已经为此苦苦挣扎了 2 天。

0 投票
2 回答
389 浏览

ios - 在 Swift 3 的值类型中访问 Objective-C 类别的属性(关联参考)

在我的 Objective-C 类的 .h 文件中,我为 NSIndexPath 创建了一个类别,如下所示:

在那个类的 .m 文件中,我已经实现了:

现在,当我在 Swift 3 中使用 IndexPath 访问 NSIndexPath 的 subRow 属性时,它给了我错误:

“IndexPath”类型的值没有成员“subRow”

如果我尝试使用类型转换访问它

它总是将“0”作为“subRow”值返回给我。可能是因为 IndexPath 是值类型而 NSIndexPath 是引用类型。

我已经使用 Objective-C 将 UITableViewDelegate 实现到我的自定义委托并将其实现到 Swift 类,但是在我实现自定义委托方法的 Swift 中,我遇到了这个问题。

我还尝试在我的自定义委托实现(Swift 代码)中使用 NSIndexPath 而不是 IndexPath,但它给了我错误“Type YVViewController 不符合协议,Candidate has non matching-type”。

这是我的自定义代表声明:

它在 Swift 2.x 上运行得非常好,但是在迁移到 Swift 3 之后,我遇到了这个问题。

0 投票
1 回答
1451 浏览

swift - 找不到 CocoaPods 桥接头文件

这里是新开发人员,我目前正在快速构建一个应用程序。我们正在使用 cocoapods,但是在运行 pod install 之后,我们在 Objective-c 桥接头中收到一个错误,指出该文件无法找到,但对于我们桥接头中的所有文件都找不到。例如,我们使用 DateTools。我们 pod 安装它,在我们放置的桥接头中: #import <DateTools/DateTools.h> 但是,在运行时,它会出错,说'Datetools/Datetools.h' file not found. 我已经浏览了许多其他类似的帖子(例如thisthisthis),但没有一个解决了这个问题。任何帮助将不胜感激!

0 投票
1 回答
658 浏览

objective-c - Obj-C 非空函数返回给 Swift 什么?

我有一个目标 c 库,可以使用桥接头在 Swift 中使用。

我的一个公共方法被注释为返回nonnull,但实际上在某些情况下它可以返回 nil。

我原以为调用此方法的 Swift 代码会崩溃,因为“解包 nil 可选值”,但实际上并没有。

目标-C:

斯威夫特标题:

生成标头如下所示:

迅捷用法:

当我po返回值时,我得到了这个结果

怎么会?

0 投票
0 回答
124 浏览

swift - Swift 构建太长,可能是因为构建时在每个文件中都包含头文件

我的项目正在使用亚马逊商业服务。它有一个名为CommonTypes.h. 该文件导入了大约 130 个其他头文件。在Bridging-Header.h我的应用程序的文件中,我CommonTypes.h在其他库旁边包含了。

在构建应用程序时,我发现构建一个 swift 文件需要花费太多时间,大约 5-7 秒。假设我的项目包含 500 个 swift 文件,重建大约需要 50 分钟。

我在项目构建时看到的日志:

我猜构建器花费了很多时间,因为它在构建每个文件时都会导入这些头文件。

有谁知道如何强制这些库只构建一次?

0 投票
0 回答
150 浏览

tvos - tvOS 部署目标不存在

我正在开发我的第一个 tvo。需要经验丰富的开发人员的建议,因为我在网上看不到很多可用的解决方案。我担心的是我的项目设置,信息选项卡,它说没有找到 macos 或 ios 目标。如何将其更改为 tvos?除此之外,我已经按照http://stackoverflow.com/questions/32489992/how-to-extend-ios-app-to-tvos/40481251?noredirect=1#comment68206928_40481251给出的步骤移植了我的 iOS 应用程序。但是我遇到了一个错误,即找不到“Contentful/Contentful.h”文件

我尝试了所有可能的设置,但仍未解决。如果有人知道部署目标和桥接头问题,请指导我。请帮帮我,我最近两天一直在努力。

0 投票
0 回答
57 浏览

ios - iOS Swift 项目,有 Objective-C 文件,我想将一个 swift 类导入到 Objective-C 文件中

我有一个 Swift 项目,我成功地将一些 Objective C 类文件添加到这个 Swift 项目中,并且能够在项目中使用它,使用桥接头。

现在在这些 Objective C 类中,我想导入一个 Swift 类。我怎样才能做到这一点?

我已经搜索了很多,但还没有找到任何答案。大多数回答的问题是关于如何将 Objective-C 类导入到 Swift 项目中,或者将 Swift 类导入到 Objective-C 项目中。但我的情况不同

0 投票
2 回答
341 浏览

ios - iOS Swift 项目,已经导入了 Objective-C 文件,我想在这个 Objective-C 中导入一个 swift 类

我有一个 Swift 项目,我成功地将一些 Objective C 类文件(比如说 ObjectiveClass.h)添加到这个 Swift 项目中,并且能够在项目中使用它,使用桥接头。现在在 ObjectiveClass.h 类中,我想导入 Swift 项目的 Swift 类。我怎样才能做到这一点?

我已经搜索了很多,但还没有找到任何答案。大多数回答的问题是关于如何将 Objective-C 类导入到 Swift 项目中,或者将 Swift 类导入到 Objective-C 项目中。但我的情况不同

0 投票
1 回答
145 浏览

ios - iTunes Store app validation error when using pod Google/CloudMessaging

I added GCM as google does in their example swift project: https://github.com/googlesamples/google-services/tree/master/ios/gcm

  1. Library installed via pod 'Google/CloudMessaging'
  2. Added #import <Google/CloudMessaging.h> in Bridge-Header.h

After uploading build to iTunes I received this email from Apple:

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GGLInstanceID/GGLInstanceID.h' which resolves to a location 'Headers/Private/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceID.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GGLInstanceID/GGLInstanceIDConfig.h' which resolves to a location 'Headers/Private/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDConfig.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GGLInstanceID/GGLInstanceIDDelegate.h' which resolves to a location 'Headers/Private/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDDelegate.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GGLInstanceID/GGLInstanceIDHeaders.h' which resolves to a location 'Headers/Private/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDHeaders.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/AdMob-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/AdMob-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/Analytics-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/Analytics-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/AppInvite-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/AppInvite-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/CloudMessaging-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/CloudMessaging-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/CloudMessaging.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCloudMessaging/Public/CloudMessaging.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/Core-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/Core-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/Core.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCore/Public/Core.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/GGLConfiguration.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLConfiguration.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/GGLContext+CloudMessaging.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCloudMessaging/Public/GGLContext+CloudMessaging.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/GGLContext.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLContext.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/GGLErrorCode.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLErrorCode.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/GMRConfiguration.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/GGLCore/Public/GMRConfiguration.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/Google/Google/SignIn-Module.h' which resolves to a location 'Headers/Private/Google/Google/../../../../Google/Headers/ModuleHeaders/SignIn-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GoogleCloudMessaging/GCMConfig.h' which resolves to a location 'Headers/Private/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMConfig.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GoogleCloudMessaging/GCMPubSub.h' which resolves to a location 'Headers/Private/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMPubSub.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GoogleCloudMessaging/GCMReceiverDelegate.h' which resolves to a location 'Headers/Private/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMReceiverDelegate.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GoogleCloudMessaging/GCMService.h' which resolves to a location 'Headers/Private/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMService.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Private/GoogleCloudMessaging/GoogleCloudMessaging.h' which resolves to a location 'Headers/Private/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GoogleCloudMessaging.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GGLInstanceID/GGLInstanceID.h' which resolves to a location 'Headers/Public/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceID.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GGLInstanceID/GGLInstanceIDConfig.h' which resolves to a location 'Headers/Public/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDConfig.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GGLInstanceID/GGLInstanceIDDelegate.h' which resolves to a location 'Headers/Public/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDDelegate.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GGLInstanceID/GGLInstanceIDHeaders.h' which resolves to a location 'Headers/Public/GGLInstanceID/../../../GGLInstanceID/Headers/Public/GGLInstanceIDHeaders.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/AdMob-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/AdMob-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/Analytics-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/Analytics-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/AppInvite-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/AppInvite-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/CloudMessaging-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/CloudMessaging-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/CloudMessaging.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCloudMessaging/Public/CloudMessaging.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/Core-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/Core-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/Core.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCore/Public/Core.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/GGLConfiguration.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLConfiguration.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/GGLContext+CloudMessaging.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCloudMessaging/Public/GGLContext+CloudMessaging.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/GGLContext.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLContext.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/GGLErrorCode.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCore/Public/GGLErrorCode.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/GMRConfiguration.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/GGLCore/Public/GMRConfiguration.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/Google/Google/SignIn-Module.h' which resolves to a location 'Headers/Public/Google/Google/../../../../Google/Headers/ModuleHeaders/SignIn-Module.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GoogleCloudMessaging/GCMConfig.h' which resolves to a location 'Headers/Public/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMConfig.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GoogleCloudMessaging/GCMPubSub.h' which resolves to a location 'Headers/Public/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMPubSub.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GoogleCloudMessaging/GCMReceiverDelegate.h' which resolves to a location 'Headers/Public/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMReceiverDelegate.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GoogleCloudMessaging/GCMService.h' which resolves to a location 'Headers/Public/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GCMService.h' that does not exist or is outside of the package.

Invalid Symlink - Your package contains a symbolic link 'Headers/Public/GoogleCloudMessaging/GoogleCloudMessaging.h' which resolves to a location 'Headers/Public/GoogleCloudMessaging/../../../GoogleCloudMessaging/Headers/Public/GoogleCloudMessaging.h' that does not exist or is outside of the package.

Once these issues have been corrected, you can then redeliver the corrected binary.

What am I doing wrong? Thanks.

0 投票
1 回答
266 浏览

ios - 我想快速使用目标 C 代码。添加桥接头后,我开始收到所有原始数据类型的错误

我有一个模型

我的桥接头看起来像这样

我的 Swift 控制器看起来像这样

我开始收到编译时错误,例如

我转到构建设置,发现为Objective-C Bridging header键 设置了头文件引用在此处输入图像描述