2011-11-15 11 views
5

come spiegato qui ->Retrieving Carrier Name from iPhone ProgrammaticallyiOS Non posso avere il mio nome vettore

sto cercando di ottenere il nome della mia carriera, sto usando questo codice

CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; 
CTCarrier *carrier = [netinfo subscriberCellularProvider]; 
NSLog(@"Carrier Name: %@", [carrier carrierName]); 
[netinfo release]; 

ma ho ricevere un avviso su [carrier carrierName]: metodo istanza '-carrierName' non trovato

ho aggiunto e il framework coretelephony al mio progetto ma quando eseguo la mia app si blocca!

grazie a tutti!

risposta

13

Hai importato in modo esplicito CTCarrier?

#import <CoreTelephony/CTCarrier.h> 
+2

mi importava solo ... -.- 'grazie – Janky

+0

im ricevendo operatore come CTCarrier (0x174059200) { \t Nome dell'operatore: [Vettore] – Balu

+0

Per favore, fai una nuova domanda, che ha a che fare con un errore di compilazione. – Eric

0

Prova

NSLog(@"Carrier Name: %@", carrier.carrierName); 

invece.

+0

si dice " 'CARRIERNAME' Poperty non può essere trovato in oggetto di classe in avanti 'CTCarrier *' – Janky

+1

che iOS sono voi compilazione per, tra l'altro? 3.0 o 4.0 o? –

+0

4.0 e 5.0 sia – Janky

1

Ho lo stesso problema troppo, e provo ad accedere dal dispositivo:

NSLog(@"carrierName = %@",carrier.carrierName); 
NSLog(@"mobileCountryCode = %@",carrier.mobileCountryCode); 
NSLog(@"mobileNetworkCode = %@",carrier.mobileNetworkCode); 
NSLog(@"isoCountryCode = %@",carrier.isoCountryCode); 
NSLog(@"allowVOIP = %d",carrier.allowsVOIP); 

risultato:

2012-05-29 11: 48: 31,466 carrierTest [357: 707] mobileCountryCode = 466

2012-05-29 11: 48: 31,469 carrierTest [357: 707] mobileNetworkCode = 97

2012-05-29 11: 48: 31,470 carrierTest [357: 707] isoCountryCode = tw

2012-05-29 11: 48: 31,472 carrierTest [357: 707] allowVOIP = 1

l'oggetto è CARRIERNAME" .... . "in run stack, in realtà dovrebbe essere" 台湾 大哥大 "

sembra un problema di codifica delle stringhe perché non riesco a ottenerlo? Non ne ho idea ...

puoi provare l'altra scheda SIM del gestore.

Problemi correlati