1

好吧,我对电话间隙很陌生。一天前,我用 Xcode 4.2 版将它安装在 MAC OSX 10.7.1 上。

  • 首先,我在 Xcode 中看不到创建电话间隙应用程序的选项。但是我可以使用终端实现它。(后来才知道,这可能就是它在这个版本上的工作方式)。
  • 其次,我按照本教程尝试添加插件。当我编译时,它给了我致命的错误。'CDVPlugin.h' file not found. 但我可以在Cordovalib.xcodeproj中看到它

NativeControls.h

#import <Cordova/CDVPlugin.h>
#else
#import "CDVPlugin.h"
#endif

那么谁能指出我做错了什么?我是否需要再次添加 CDVPlugin.h 和相关文件?

4

2 回答 2

1

NativeControls.h修改文件和修改后编译工作NativeControls.m

修改NativeControls.h

//
// NativeControls.h
//
//
// Created by Jesse MacFadyen on 10-02-03.
// MIT Licensed

// Originally this code was developed my Michael Nachbaur
// Formerly -> PhoneGap :: UIControls.h
// Created by Michael Nachbaur on 13/04/09.
// Copyright 2009 Decaf Ninja Software. All rights reserved.

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UIKit/UITabBar.h>
#import <UIKit/UIToolbar.h>

//#ifdef PHONEGAP_FRAMEWORK
#import <Cordova/CDVPlugin.h>
//#else
//#import "CDVPlugin.h"
//#endif

@interface NativeControls : CDVPlugin <UITabBarDelegate, UIActionSheetDelegate> {
    UITabBar* tabBar;
    NSMutableDictionary* tabBarItems;

    UIToolbar* toolBar;
    UIBarButtonItem* toolBarTitle;
    NSMutableArray* toolBarItems;

    CGRect  originalWebViewBounds;
}

/* Tab Bar methods
 */
- (void)createTabBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)showTabBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)hideTabBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)showTabBarItems:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)createTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)updateTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)selectTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options;



/* Tool Bar methods
 */
- (void)createToolBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)resetToolBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)setToolBarTitle:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)createToolBarItem:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)showToolBar:(NSArray*)arguments withDict:(NSDictionary*)options;
- (void)hideToolBar:(NSArray*)arguments withDict:(NSDictionary*)options;
/* ActionSheet
 */
- (void)createActionSheet:(NSArray*)arguments withDict:(NSDictionary*)options;


@end

文件中的修改NativeControls.m:在第 22 行,更改PGPluginCDVPlugin

希望这会有所帮助。

于 2012-09-12T10:36:46.920 回答
1

在 Cordova 2.1(仅限)中,我通过简单地注释掉给定 PushNotification 插件的 if/else 来解决这个错误

#import <Foundation/Foundation.h>
//#ifdef CORDOVA_FRAMEWORK
#import <Cordova/CDVPlugin.h>
//#else
//#import "CDVPlugin.h"
//#endif
#import <EventKitUI/EventKitUI.h>
#import <EventKit/EventKit.h>
于 2012-10-31T17:39:27.227 回答