Skip to content

Commit c11fd9c

Browse files
committed
Fix LocationManager, ParseManager, Analytics for tvOS.
1 parent 06ed95f commit c11fd9c

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Parse/Internal/PFLocationManager.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,23 @@ - (void)addBlockForCurrentLocation:(PFLocationManagerLocationUpdateBlock)handler
9696
[self.blockSet addObject:[handler copy]];
9797
}
9898

99+
//
100+
// Abandon hope all ye who enter here.
101+
// Apparently, the CLLocationManager API is different for iOS/OSX/watchOS/tvOS up to the point,
102+
// where encapsulating pieces together just makes much more sense
103+
// than hard to human-parse compiled out pieces of the code.
104+
// This looks duplicated, slightly, but very much intentional.
105+
//
99106
#if TARGET_OS_WATCH
100107
if ([self.bundle objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) {
101108
[self.locationManager requestWhenInUseAuthorization];
102109
} else {
103110
[self.locationManager requestAlwaysAuthorization];
104111
}
105112
[self.locationManager requestLocation];
113+
#elif TARGET_OS_TV
114+
[self.locationManager requestWhenInUseAuthorization];
115+
[self.locationManager requestLocation];
106116
#elif TARGET_OS_IOS
107117
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
108118
if (self.application.applicationState != UIApplicationStateBackground &&
@@ -113,7 +123,7 @@ - (void)addBlockForCurrentLocation:(PFLocationManagerLocationUpdateBlock)handler
113123
}
114124
}
115125
[self.locationManager startUpdatingLocation];
116-
#elif TARGET_OS_MAC
126+
#elif PF_TARGET_OS_OSX
117127
[self.locationManager startUpdatingLocation];
118128
#endif
119129
}

Parse/Internal/ParseManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PFInstallationIdentifierStoreProvider>
4242

4343
@property (nonatomic, strong) PFAnalyticsController *analyticsController;
4444

45-
#if TARGET_OS_IOS
45+
#if TARGET_OS_IOS || TARGET_OS_TV
4646
@property (nonatomic, strong) PFPurchaseController *purchaseController;
4747
#endif
4848

Parse/PFAnalytics.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ @implementation PFAnalytics
2525
///--------------------------------------
2626

2727
+ (BFTask PF_GENERIC(NSNumber *)*)trackAppOpenedWithLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions {
28-
#if TARGET_OS_WATCH
28+
#if TARGET_OS_WATCH || TARGET_OS_TV
2929
NSDictionary *userInfo = nil;
3030
#elif TARGET_OS_IOS
3131
NSDictionary *userInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];

0 commit comments

Comments
 (0)