Question

Je NSString statique comme ci-dessous:

static NSString *bowlerName;

Dans le code, je suis avec lui attribuant une valeur comme suit:

 -(void)setBowlerSpecifications:(int)playerId
 {  
  Player *objPlayer =  [CricketManagementDAL getBowlerSpecification :playerId];
  [objPlayer retain];
  bowlerSpecialSkill = objPlayer.specialSkill;
  bowlerType = objPlayer.type;
  bowlerName = objPlayer.playerName; // <------------
  [objPlayer release];
 } 

Maintenant, si je me réfère à la même bowlerName variable dans le code nulle part ailleurs, je reçois l'erreur:

Variable is not a CFString.

S'il vous plaît aidez-moi.

Était-ce utile?

La solution

Il est un NSString mais que vous utilisez ailleurs dans un contexte qui attend un CFString, vous pouvez simplement jeté comme suit

CFStringRef aCFString = (CFStringRef)aNSString;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top