main.mm 780 B

1234567891011121314151617181920212223242526272829
  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. NSBundle* bundle = [NSBundle bundleWithPath: bundlePath];
  8. if ([bundle isLoaded] == false) [bundle load];
  9. UnityFramework* ufw = [bundle.principalClass getInstance];
  10. if (![ufw appController])
  11. {
  12. // unity is not initialized
  13. [ufw setExecuteHeader: &_mh_execute_header];
  14. }
  15. return ufw;
  16. }
  17. int main(int argc, char* argv[])
  18. {
  19. @autoreleasepool
  20. {
  21. id ufw = UnityFrameworkLoad();
  22. [ufw runUIApplicationMainWithArgc: argc argv: argv];
  23. return 0;
  24. }
  25. }