昨天我參加了watchkit hackathon,在調用NSObject類的方法時遇到了一些問題,該類使用Google Maps API併發送本地通知。如果我把這個方法從我Watchkit擴展,代碼不編譯,但如果我從視圖控制器打電話,例如,一切完美在Watchkit上調用方法
#import "InterfaceController.h"
#import "Methods.h"
@interface InterfaceController()
@end
@implementation InterfaceController
- (instancetype)initWithContext:(id)context {
self = [super initWithContext:context];
if (self){
// Initialize variables here.
// Configure interface objects here.
NSLog(@"%@ initWithContext", self);
}
return self;
}
- (IBAction)butRoute
{
Methods *mt = [[Methods alloc]init];
[mt notif:@"ARRIVING!"];
//***** If I call this method, my code won't compile!!! *****
}
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
NSLog(@"%@ will activate", self);
}
- (void)didDeactivate {
// This method is called when watch view controller is no longer visible
NSLog(@"%@ did deactivate", self);
}
@end
我得到的錯誤是:
你有沒有想過這個? – you786 2015-04-27 02:28:38