Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replaced the deprecated API (-initWithBase64Encoding:) for OS X v10.9…
… and later (maintaining compatibility)
  • Loading branch information
torinkwok committed Apr 1, 2015
1 parent e8a3022 commit 4e0957e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions INAppStoreWindow/INAppStoreWindow.m
Expand Up @@ -149,11 +149,22 @@ + (NSColor *)windowPatternOverlayColor

static dispatch_once_t oncePredicate;
dispatch_once(&oncePredicate, ^{
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64Encoding:INWindowBackgroundPatternOverlayLayer]];
NSBitmapImageRep *rep = nil;

// initWithBase64EncodedString:options: is available in OS X v10.9 and later
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_9
rep = [[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64EncodedString: INWindowBackgroundPatternOverlayLayer options: 0]];
#else
rep = [[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64Encoding:INWindowBackgroundPatternOverlayLayer]];
#endif
NSImage *image = [[NSImage alloc] initWithSize:rep.size];
[image addRepresentation:rep];
[image addRepresentation:[[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64Encoding:INWindowBackgroundPatternOverlayLayer2x]]];

#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_9
[image addRepresentation:[[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64EncodedString: INWindowBackgroundPatternOverlayLayer2x options: 0]]];
#else
[image addRepresentation:[[NSBitmapImageRep alloc] initWithData:[[NSData alloc] initWithBase64Encoding:INWindowBackgroundPatternOverlayLayer2x]]];
#endif
noiseColor = [NSColor colorWithPatternImage:image];
});

Expand Down

0 comments on commit 4e0957e

Please sign in to comment.