昨天我参加了一个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 …Run Code Online (Sandbox Code Playgroud)