Skip to content

compile errors #2

@frakman1

Description

@frakman1

Thank you for sharing your excellent code examples for LIFX. It has been a tremendous help.

In LFXLocalTransportManager.m. I get this build error:

\LIFX-Watch-Remote/LIFX-Watch-Remote-master/Pods/LIFXKit/LIFXKit/Classes-Common/LFXLocalTransportManager.m:86:24: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

This is the code it is pointing to:

- (BOOL)shouldIgnoreTCPConnections
{
#if TARGET_OS_IPHONE
    return [UIApplication sharedApplication].applicationState != UIApplicationStateActive;
#endif
    return NO;
}

I also get this error:

/LIFX-Watch-Remote-master/Pods/LIFXKit/LIFXKit/Classes-iOS/LFXWiFiObserverIOS.m:30:28: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

This is the code it is pointing to:

- (id)init
{
    if ((self = [super init]))
    {
        MakeWeakRef(self, weakSelf);
        [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
            [weakSelf updateNetworkInfo];
            [weakSelf createPollingTimer];
        }];
        [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
            [weakSelf updateNetworkInfo];
            [weakSelf destroyPollingTimer];
        }];
        if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground)
        {
            [self createPollingTimer];
        }
    }
    return self;
}

I was able to workaround this by forcing a return of NO in the first function, and by commenting out the offending code in the second. There don't appear to be any repercussions but I was hoping you could provide some insight as to what is going on and what the best way of addressing this would be.

I am not sure what pod and/or iOS version dependency comes into play here but for what it is worth, I am using Xcode 6.3.2 with iOS 8.3 on OSX 10.10.3, building for iPhone.

I tried adding AF_APP_EXTENSIONS and PURELAYOUT_APP_EXTENSIONS=1 manually to the macro pre-processor as well as changing the podfile but I might not have done it correctly.

Any help or advice would be greatly appreciated as I am new to podfiles and iOS programming in general.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions