iOS - _OBJC_CLASS_$_CTTelephonyNetworkInfo not found?

Suchi picture Suchi · Nov 17, 2011 · Viewed 21.2k times · Source

I am using the following code to get network info about my iPhone -

#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>


CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netInfo subscriberCellularProvider];
NSString *osVersion = [[UIDevice currentDevice] systemVersion];

But I get the error -

Undefined symbols for architecture armv7:
 "_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
  objc-class-ref in MyClass.o
ld: symbol(s) not found for architecture armv7

Isn't the class a part of the iOS SDK? What am I doing wrong?

Answer

Joe picture Joe · Nov 17, 2011

It is part of the CoreTelephony.framework. You need to add that framework for your code to work.