Trước tiên hãy sao chép nội dung sau vào tệp có tên RadioPreferences.h
. (Lấy từ https://stackoverflow.com/a/13095362/418715).
@protocol RadiosPreferencesDelegate
-(void)airplaneModeChanged;
@end
@interface RadiosPreferences : NSObject
{
struct __SCPreferences *_prefs;
int _applySkipCount;
id <RadiosPreferencesDelegate> _delegate;
BOOL _isCachedAirplaneModeValid;
BOOL _cachedAirplaneMode;
BOOL notifyForExternalChangeOnly;
}
- (id)init;
- (void)dealloc;
@property(nonatomic) BOOL airplaneMode;
- (void)refresh;
- (void)initializeSCPrefs:(id)arg1;
- (void)notifyTarget:(unsigned int)arg1;
- (void)synchronize;
- (void *)getValueForKey:(id)arg1;
- (void)setValue:(void *)arg1 forKey:(id)arg2;
@property(nonatomic) BOOL notifyForExternalChangeOnly; // @synthesize notifyForExternalChangeOnly;
@property(nonatomic) id <RadiosPreferencesDelegate> delegate; // @synthesize delegate=_delegate;
@end
- Tiếp theo, đi đến giai đoạn xây dựng của mục tiêu của bạn trong Xcode và mở rộng liên kết Binary Với Libraries phần.
- Trong cửa sổ công cụ tìm điều hướng đến
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks
. Thay thế iPhoneOS6.0.sdk
trong đường dẫn bằng sdk bạn đang nhắm mục tiêu.
- Kéo AppSupport.framework sang phần mở rộng Liên kết nhị phân với thư viện của bạn.
Mọi thứ giờ đây sẽ biên dịch và bạn sẽ có thể sử dụng lớp học.
Xem ở đây http://stackoverflow.com/questions/13095109/reachability-airplane-mode-3g-vs-wifi – Joe
tôi nhận được: 'những biểu tượng Không xác định cho kiến trúc ARMv7: "_OBJC_CLASS _ $ _ RadiosPreferences", tham chiếu từ: objc-class-ref trong NetworkManager.o ld: (các) biểu tượng không tìm thấy cho kiến trúc armv7 clang: lỗi: lệnh liên kết không thành công với mã thoát 1 (sử dụng -v để xem lời gọi) ' – ninjaneer
Bạn tìm thấy ở đâu 'RadioPreferences.h', bạn cần đảm bảo rằng bạn liên kết với khung chính xác? – Joe