iPhone + NS字符串错误
我有静态 NSString
如下:
static NSString *bowlerName;
在代码中,我为它分配了一些值,如下所示:
-(void)setBowlerSpecifications:(int)playerId
{
Player *objPlayer = [CricketManagementDAL getBowlerSpecification :playerId];
[objPlayer retain];
bowlerSpecialSkill = objPlayer.specialSkill;
bowlerType = objPlayer.type;
bowlerName = objPlayer.playerName; // <------------
[objPlayer release];
}
现在,如果我在其他地方的代码中引用相同的变量 bowlerName
,我收到错误:
Variable is not a CFString.
请帮我。
I have static NSString
as below:
static NSString *bowlerName;
In the code I am assigning it with some value as below:
-(void)setBowlerSpecifications:(int)playerId
{
Player *objPlayer = [CricketManagementDAL getBowlerSpecification :playerId];
[objPlayer retain];
bowlerSpecialSkill = objPlayer.specialSkill;
bowlerType = objPlayer.type;
bowlerName = objPlayer.playerName; // <------------
[objPlayer release];
}
Now, if I am referring to the same variable bowlerName
in code anywhere else, I get the error:
Variable is not a CFString.
Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它是一个 NSString,但您在需要 CFString 的上下文中的其他地方使用它,您可以简单地进行如下转换
It is an NSString but you are using it elsewhere in a context that expects a CFString, you can simply cast as follows