Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. NSBundle *bundle = [NSBundle mainBundle];
  2. if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) {
  3. // Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
  4. bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
  5. }
  6.  
  7. NSString *appDisplayName = [bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"];
  8.  
  9. var bundle = NSBundle.mainBundle()
  10. if bundle.bundleURL.pathExtension == "appex" {
  11. // Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
  12. bundle = NSBundle(URL: bundle.bundleURL.URLByDeletingLastPathComponent!.URLByDeletingLastPathComponent!)!
  13. }
  14.  
  15. let appDisplayName = bundle.objectForInfoDictionaryKey("CFBundleDisplayName")
  16.  
  17. var bundle = Bundle.main
  18. if bundle.bundleURL.pathExtension == "appex" {
  19. // Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
  20. let url = bundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
  21. if let otherBundle = Bundle(url: url) {
  22. bundle = otherBundle
  23. }
  24. }
  25.  
  26. let appDisplayName = bundle.object(forInfoDictionaryKey: "CFBundleDisplayName")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement