Skip to content

Commit 649fc6d

Browse files
alloyWatson1978
authored andcommitted
Revert "[osx] Allow the user to configure a NSApplication subclass and use that instead."
This reverts commit 51538c0. Conflicts: test/test/spec/main_spec.rb
1 parent ea6fd1b commit 649fc6d

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

lib/motion/project/template/osx/config.rb

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -230,36 +230,20 @@ def main_cpp_file_txt(spec_objs)
230230
end
231231
main_txt << <<EOS
232232
RubyMotionInit(argc, argv);
233-
NSApplication *app = [NSClassFromString(@"#{info_plist['NSPrincipalClass']}") sharedApplication];
233+
NSApplication *app = [NSApplication sharedApplication];
234234
[app setDelegate:[NSClassFromString(@"#{delegate_class}") new]];
235235
EOS
236236
if spec_mode
237237
main_txt << "SpecLauncher *specLauncher = [[SpecLauncher alloc] init];\n"
238238
main_txt << "[[NSNotificationCenter defaultCenter] addObserver:specLauncher selector:@selector(appLaunched:) name:NSApplicationDidFinishLaunchingNotification object:nil];\n"
239239
end
240-
if use_application_main_function?
241-
main_txt << "NSApplicationMain(argc, (const char **)argv);\n"
242-
else
243-
main_txt << "[app run];\n"
244-
end
245240
main_txt << <<EOS
241+
NSApplicationMain(argc, (const char **)argv);
246242
[pool release];
247243
rb_exit(0);
248244
return 0;
249245
}
250246
EOS
251247
end
252-
253-
# If the user specifies a custom principal class the NSApplicationMain()
254-
# function will only work if they have also specified a nib or storyboard.
255-
def use_application_main_function?
256-
info = info_plist
257-
if info['NSPrincipalClass'] == 'NSApplication'
258-
true
259-
else
260-
files = info.values_at('NSMainNibFile', 'NSMainStoryboardFile').compact
261-
files.any? { |file| !file.strip.empty? }
262-
end
263-
end
264248
end
265249
end; end

0 commit comments

Comments
 (0)