【发布时间】:2013-11-25 04:51:12
【问题描述】:
我创建了一个类 AuthService
在 AuthService 声明中我有这个
- (MSClient *) getClient;
在实现中(.m 文件)我有这个
- (MSClient *) getClient{
client =[MSClient clientWithApplicationURLString:@"XXXXXXX/"
applicationKey:@"XXXXXXX"];
return client;
}
现在我正在尝试在单击按钮期间在视图控制器中获取 MSClient 的实例,如下所示。
AuthSerivce 类首先在 .h 文件中这样初始化
@property (strong, nonatomic) AuthService *authService;
client 被声明为 MSClient 对象并合成如下
@synthesize client;
然后我尝试从 AuthService 类创建一个客户端对象(是的,我在视图控制器中引用了 AuthService.h)
client = [authService getClient];
但我的问题是,getClient 总是返回 nil
我确定我在基本目标 c OOP 概念中遗漏了一些东西。请纠正我。
【问题讨论】:
-
你是如何初始化 authService 的??
-
@MidhunMP 嘿,我已经有了上面的
getClient方法 -
@MrjComics:我错了,请发
clientWithApplicationURLString方法。 -
` @property (strong, nonatomic) AuthService *authService;` 像这样初始化
-
@MidhunMP 谢谢。
clientWithApplicationURLString是来自 Azure sdk 的框架方法。
标签: ios objective-c oop ios7 azure-mobile-services