我正在嘗試構建一個客觀的C++類,它編譯得很好,直到有人試圖使用該類。我想開一個的viewController與模態視圖控制器,但編譯器給了我這樣的警告:找不到iPhone SDK符號,在.mm文件中定義
MainView.mm: warning: Semantic Issue: Method
「-presentModalViewController:動畫:」未找到(返回類型默認爲 「身份證」)
.H
#import <UIKit/UIKit.h>
@interface MainView : UIView <UIApplicationDelegate> {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
- (IBAction)showInfo;
.mm:
#import "Calendar.h"
@implementation MainView
@synthesize window , day ,year ,myDate ,eventsLabel , bg;
- (id)initWithFrame:(CGRect)frame {
if (self == [super initWithFrame:frame]) {
}
return self;
}
- (IBAction)showCal {
Calendar *controller = [[Calendar alloc] initWithNibName:nil bundle:nil];
[MainView presentModalViewController:controller animated:YES];
[controller release];
}
和應用程序崩潰!那麼我能做些什麼來解決這個問題呢?
您應該顯示使用'-presentModalViewController:animated:'的代碼。我的猜測是你試圖在錯誤類的對象上調用該方法。 – 2011-04-04 13:41:35
看到我編輯的文章 – 2011-04-04 13:43:04
發佈代碼用於演示ModelViewController – kthorat 2011-04-04 13:46:24