Domanda

Nella codifica successiva, voglio passare la variabile tramite CFSTR, come posso?

ABMutableMultiValueRef address = ABMultiValueCreateMutable(kABDictionaryPropertyType);
// Set up keys and values for the dictionary.

CFStringRef keys[5];

CFStringRef values[5];

keys[0] = kABPersonAddressStreetKey;

keys[1] = kABPersonAddressCityKey;

keys[2] = kABPersonAddressStateKey;

keys[3] = kABPersonAddressZIPKey;

keys[4] = kABPersonAddressCountryKey;

values[0] = CFSTR("Wiztech, 208/B Clifton Center, Karachi");

//values[0] = CFSTR(address1); I want to pass address1 which is NSString, how can I?

values[1] = CFSTR("");

values[2] = CFSTR("");

values[3] = CFSTR("");

values[4] = CFSTR("");
.

È stato utile?

Soluzione

Ho appena lanciato come:

NSString * yourThing = [NSString stringWithString:@"blah blah"]
values[0] = (CFStringRef)yourThing;
.

NSString e CFString sono intercambiabili (soggetti ad essere cast).Non dimenticare di conservare / rilasciare anche

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top