如何为iOS9的Cordova应用添加今天的视图扩展? [迅速]

时间:2016-06-07 06:39:44

标签: cordova hybrid-mobile-app ios9-today-widget

我按照this教程创建了今天的视图扩展程序。它适用于基于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'

3 个答案:

答案 0 :(得分:2)

我最近通过创建一个cordova-plugin解决了这个问题,该插件在cordova-ios项目中添加了一个(已经实现的)今天的小部件:请参阅我的回答here

答案 1 :(得分:0)

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

答案 2 :(得分:0)

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