开发者

iPhone + NSString error

开发者 https://www.devze.com 2022-12-14 14:11 出处:网络
I have static NSString as below: static NSString *bowlerName; In the code I am assigning it with some value as below:

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 anywh开发者_如何学JAVAere else, I get the error:

Variable is not a CFString.

Please help me.


It is an NSString but you are using it elsewhere in a context that expects a CFString, you can simply cast as follows

CFStringRef aCFString = (CFStringRef)aNSString;
0

精彩评论

暂无评论...
验证码 换一张
取 消