Fix 'nib' warning in latest version of Xcode for Mac.

I'm not sure this is the best way to do it, but I don't really know Obj-C.
This commit is contained in:
Stephen Anthony 2022-01-07 20:20:23 -03:30
parent 11d2f34bcb
commit c59d9a6f81
3 changed files with 10 additions and 9 deletions

View File

@ -25,6 +25,8 @@
*/ */
@interface AboutBox : NSObject @interface AboutBox : NSObject
@property (nonatomic, strong) IBOutlet NSWindow *theWindow;
+ (AboutBox *)sharedInstance; + (AboutBox *)sharedInstance;
- (IBAction)showPanel:(id)sender; - (IBAction)showPanel:(id)sender;
- (IBAction)OK:(id)sender; - (IBAction)OK:(id)sender;

View File

@ -52,7 +52,6 @@ static AboutBox *sharedInstance = nil;
if (!appNameField) if (!appNameField)
{ {
NSWindow *theWindow;
NSString *creditsPath; NSString *creditsPath;
NSAttributedString *creditsString; NSAttributedString *creditsString;
NSString *appName; NSString *appName;
@ -61,13 +60,13 @@ static AboutBox *sharedInstance = nil;
CFBundleRef localInfoBundle; CFBundleRef localInfoBundle;
NSDictionary *localInfoDict; NSDictionary *localInfoDict;
if (![NSBundle loadNibNamed:@"AboutBox" owner:self]) if (![[NSBundle mainBundle] loadNibNamed:@"AboutBox" owner:self topLevelObjects:nil])
{ {
NSLog( @"Failed to load AboutBox.nib" ); NSLog( @"Failed to load AboutBox.nib" );
NSBeep(); NSBeep();
return; return;
} }
theWindow = [appNameField window]; self.theWindow = [appNameField window];
// Get the info dictionary (Info.plist) // Get the info dictionary (Info.plist)
infoDictionary = [[NSBundle mainBundle] infoDictionary]; infoDictionary = [[NSBundle mainBundle] infoDictionary];
@ -81,7 +80,7 @@ static AboutBox *sharedInstance = nil;
[appNameField setStringValue:appName]; [appNameField setStringValue:appName];
// Set the about box window title // Set the about box window title
[theWindow setTitle:[NSString stringWithFormat:@"About %@", appName]]; [self.theWindow setTitle:[NSString stringWithFormat:@"About %@", appName]];
// Setup the version field // Setup the version field
versionString = [infoDictionary objectForKey:@"CFBundleVersion"]; versionString = [infoDictionary objectForKey:@"CFBundleVersion"];
@ -106,9 +105,9 @@ static AboutBox *sharedInstance = nil;
maxScrollHeight = creditsBounds.size.height*2.75; maxScrollHeight = creditsBounds.size.height*2.75;
// Setup the window // Setup the window
[theWindow setExcludedFromWindowsMenu:YES]; [self.theWindow setExcludedFromWindowsMenu:YES];
[theWindow setMenu:nil]; [self.theWindow setMenu:nil];
[theWindow center]; [self.theWindow center];
} }
if (![[appNameField window] isVisible]) if (![[appNameField window] isVisible])

View File

@ -3629,7 +3629,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_INTERFACE_IVARS = YES; CLANG_WARN_OBJC_INTERFACE_IVARS = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = NO;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;
@ -3706,7 +3706,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_INTERFACE_IVARS = YES; CLANG_WARN_OBJC_INTERFACE_IVARS = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = NO;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES;