I use NSUserNotification when my app is run on an OS that has them and NSAlerts when it's run on an OS that lacks them. My code looks like this:
My Deployment Target is 10.5 while my Base SDK is 10.9.
Yet when my application is run on OS X 10.7.5 (and possibly other, older platforms) this error appears before any other part of my code is called:
The only linked libraries I have are:
SystemConfiguration.framework
ServiceManagement.framework
libz.dylib
IOBluetooth.framework
IOKit.framework
Cocoa.framework
What am I doing wrong? How can I fix this error without losing either compatibility with OS X 10.5 - 10.9 but still display NSUserNotifications in versions of OS X that allow it?
Code:
- (void)deployWarningWithTitle:(NSString*)title andMessage:(NSString*)message {
if (NSClassFromString(@"NSUserNotification")) {
NSUserNotification* notification = [[NSUserNotification alloc] init];
notification.soundName = NSUserNotificationDefaultSoundName;
notification.title = title;
notification.informativeText = message;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[notification release];
} else {
NSAlert* alert = [[NSAlert alloc] init];
alert.messageText = title;
alert.informativeText = message;
[alert runModal];
[alert release];
}
}
My Deployment Target is 10.5 while my Base SDK is 10.9.
Yet when my application is run on OS X 10.7.5 (and possibly other, older platforms) this error appears before any other part of my code is called:
Code:
dyld: Symbol not found: _OBJC_CLASS_$_NSUserNotification
Referenced from: /Users/taylor/Dropbox/Battery Status Stuff/Battery Status Builds/1.4.1b/Battery Status.app/Contents/MacOS/Battery Status
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
The only linked libraries I have are:
SystemConfiguration.framework
ServiceManagement.framework
libz.dylib
IOBluetooth.framework
IOKit.framework
Cocoa.framework
What am I doing wrong? How can I fix this error without losing either compatibility with OS X 10.5 - 10.9 but still display NSUserNotifications in versions of OS X that allow it?
Last edited: