main.mm 826 B

123456789101112131415161718192021222324252627282930
  1. #include <UnityFramework/UnityFramework.h>
  2. UnityFramework* UnityFrameworkLoad()
  3. {
  4. NSString* bundlePath = nil;
  5. bundlePath = [[NSBundle mainBundle] bundlePath];
  6. bundlePath = [bundlePath stringByAppendingString: @"/Frameworks/UnityFramework.framework"];
  7. NSLog(@"bundlePath = %@",bundlePath);
  8. NSBundle* bundle = [NSBundle bundleWithPath: bundlePath];
  9. if ([bundle isLoaded] == false) [bundle load];
  10. UnityFramework* ufw = [bundle.principalClass getInstance];
  11. if (![ufw appController])
  12. {
  13. // unity is not initialized
  14. [ufw setExecuteHeader: &_mh_execute_header];
  15. }
  16. return ufw;
  17. }
  18. int main(int argc, char* argv[])
  19. {
  20. @autoreleasepool
  21. {
  22. id ufw = UnityFrameworkLoad();
  23. [ufw runUIApplicationMainWithArgc: argc argv: argv];
  24. return 0;
  25. }
  26. }