File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 99
1010#import < Foundation/Foundation.h>
1111
12- #if TARGET_OS_IPHONE
12+ #import < Parse/PFConstants.h>
13+
14+ #if TARGET_OS_IOS
1315#import < UIKit/UIKit.h>
14- #else
16+ #elif TARGET_OS_WATCH
17+ @class UIApplication;
18+ #elif TARGET_OS_MAC
1519#import < AppKit/AppKit.h>
1620@compatibility_alias UIApplication NSApplication ;
1721#endif
Original file line number Diff line number Diff line change 99
1010#import " PFApplication.h"
1111
12- #if TARGET_OS_IPHONE
12+ #if TARGET_OS_IOS
1313#import < UIKit/UIKit.h>
14- #else
14+ #elif !TARGET_OS_WATCH && TARGET_OS_MAC
1515#import < AppKit/AppKit.h>
1616#endif
1717
@@ -47,9 +47,11 @@ - (BOOL)isExtensionEnvironment {
4747}
4848
4949- (NSInteger )iconBadgeNumber {
50- #if TARGET_OS_IPHONE
50+ #if TARGET_OS_WATCH
51+ return 0 ;
52+ #elif TARGET_OS_IOS
5153 return self.systemApplication .applicationIconBadgeNumber ;
52- #else
54+ #elif TARGET_OS_MAC
5355 // Make sure not to use `NSApp` here, because it doesn't work sometimes,
5456 // `NSApplication +sharedApplication` does though.
5557 NSString *badgeLabel = [[NSApplication sharedApplication ] dockTile ].badgeLabel ;
@@ -71,17 +73,21 @@ - (NSInteger)iconBadgeNumber {
7173
7274- (void )setIconBadgeNumber : (NSInteger )iconBadgeNumber {
7375 if (self.iconBadgeNumber != iconBadgeNumber) {
74- #if TARGET_OS_IPHONE
76+ #if TARGET_OS_IOS
7577 self.systemApplication .applicationIconBadgeNumber = iconBadgeNumber;
76- #else
78+ #elif !TARGET_OS_WATCH
7779 [[NSApplication sharedApplication ] dockTile ].badgeLabel = [@(iconBadgeNumber) stringValue ];
7880#endif
7981 }
8082}
8183
8284- (UIApplication *)systemApplication {
85+ #if TARGET_OS_WATCH
86+ return nil ;
87+ #else
8388 // Workaround to make `sharedApplication` still be called even if compiling for App Extensions or WatchKit apps.
8489 return [UIApplication performSelector: @selector (sharedApplication )];
90+ #endif
8591}
8692
8793@end
You can’t perform that action at this time.
0 commit comments