2018년 1월 20일 토요일

IOS Private api - detect airplane mode

- (BOOL) isAirplainMode
{
    NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/AppSupport.framework"];
    BOOL success = [bundle load];
    BOOL airplain = NO;
    
    if(YES == success)
    {
        Class RadiosPreferences = NSClassFromString(@"RadiosPreferences");
        id radioPreferences = [[RadiosPreferences alloc] init];
        
        SEL selector = NSSelectorFromString(@"airplaneMode");
        if(YES == [radioPreferences respondsToSelector:selector])
        {
            airplain = [[radioPreferences valueForKey:@"airplaneMode"] boolValue];
        }
    }

    return airplain;

}

댓글 없음:

댓글 쓰기