【发布时间】:2014-11-24 19:35:01
【问题描述】:
我昨天参加了一个 watchkit 黑客马拉松,在调用 NSObject 类的方法时遇到了一些问题,该类使用 Google Maps API 并发送本地通知。如果我从我的 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
我得到的错误是:
【问题讨论】:
-
你有想过这个吗?
标签: objective-c watchkit