2

我按照教程创建了今天的视图扩展。它适用于基于原生 Xcode 7.3 iOS 9 的应用程序,但是当我尝试对 Cordova 应用程序执行相同的步骤时。我得到构建错误。

/Users/MAC/Desktop/RWS/RAD/[CORDOVA_APP_NAME]/platforms/ios/[CORDOVA_APP_NAME]/Bridging-Header.h:28:9: note: in file included from /Users/MAC/Desktop/RWS/RAD/[CORDOVA_APP_NAME]/platforms/ios/[CORDOVA_APP_NAME]/Bridging-Header.h:28:
#import <Cordova/CDV.h>
        ^
/Users/MAC/Library/Developer/Xcode/DerivedData/[CORDOVA_APP_NAME]-ggabeceockqrdjbqfzogiakufhxo/Build/Products/Debug-iphonesimulator/include/Cordova/CDV.h:20:9: note: in file included from /Users/MAC/Library/Developer/Xcode/DerivedData/[CORDOVA_APP_NAME]-ggabeceockqrdjbqfzogiakufhxo/Build/Products/Debug-iphonesimulator/include/Cordova/CDV.h:20:
#import "CDVAvailability.h"
        ^
/Users/MAC/Library/Developer/Xcode/DerivedData/[CORDOVA_APP_NAME]-ggabeceockqrdjbqfzogiakufhxo/Build/Products/Debug-iphonesimulator/include/Cordova/CDVAvailability.h:20:9: error: 'CDVAvailabilityDeprecated.h' file not found
#import "CDVAvailabilityDeprecated.h"
        ^
<unknown>:0: error: failed to import bridging header '/Users/MAC/Desktop/RWS/RAD/[CORDOVA_APP_NAME]/platforms/ios/[CORDOVA_APP_NAME]/Bridging-Header.h'
4

3 回答 3

2

我最近通过创建一个cordova-plugin 解决了这个问题,它向cordova-ios 项目添加了一个(已经实现的)today 小部件:在这里查看我的答案

于 2017-05-31T20:39:46.683 回答
1

通过在构建阶段将 Foundation.framework 和 lib.Cordova.a 添加到“Link Binary With Libraries”中,我能够解决上述问题。确保在执行此操作时选择 Today Widget Extension 作为目标。请参阅以下屏幕截图:https ://i.stack.imgur.com/dSQxG.png

于 2017-01-13T12:49:18.123 回答
0

我猜你正在使用 Cordova 文件插件。我认为目前用 swift 语言编写今天的扩展是不可能的,因为这个插件是用 C-objective 语言编写的,它与 swift 不兼容。当我尝试在 C-objective 中添加今天时,我没有收到此错误。

于 2016-12-09T09:15:19.303 回答