forked from marcuswestin/WebViewJavascriptBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example app dynamically includes Webkit if iOS 8
- Loading branch information
1 parent
84bbefc
commit 026a712
Showing
3 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
#import <TargetConditionals.h> | ||
#import <dlfcn.h> | ||
#import "ExampleAppDelegate.h" | ||
|
||
int main(int argc, char *argv[]) | ||
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
@autoreleasepool { | ||
// Dynamically load WebKit if iOS version >= 8 | ||
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { | ||
#if TARGET_IPHONE_SIMULATOR | ||
NSString *frameworkPath = [[NSProcessInfo processInfo] environment][@"DYLD_FALLBACK_FRAMEWORK_PATH"]; | ||
if (frameworkPath) { | ||
NSString *webkitLibraryPath = [NSString pathWithComponents:@[frameworkPath, @"WebKit.framework", @"WebKit"]]; | ||
dlopen([webkitLibraryPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_LAZY); | ||
} | ||
#else | ||
dlopen("/System/Library/Frameworks/WebKit.framework/WebKit", RTLD_LAZY); | ||
#endif | ||
} | ||
|
||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([ExampleAppDelegate class])); | ||
} | ||
} | ||
} |