我昨天参加了一个 watchkit 黑客马拉松,我在调用一个使用 Google Maps API 并发送本地通知的 NSObject 类上的方法时遇到了一些问题。如果我从我的 Watchkit 扩展中调用此方法,则代码不会编译,但如果我从 ViewController 调用,例如,一切正常
#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
我得到的错误是: