diff --git a/README.md b/README.md
index 53cd69d6..82fbfe50 100644
--- a/README.md
+++ b/README.md
@@ -93,6 +93,20 @@ Other possible values are `1` (`MIXED_CONTENT_NEVER_ALLOW`) and `2` (`MIXED_CONT
Preferences only available for iOS platform
+#### iosScheme
+
+```xml
+
+```
+
+Default value is `ionic`
+
+Configures the Scheme the app uses to load the content.
+
+Values like `http`, `https` or `file` are not valid and will use default value instead.
+
+If you change it, you'll need to add a new `allow-navigation` entry in the `config.xml` for the configured scheme (i.e `` if `iosScheme` is set to `httpsionic`).
+
#### WKSuspendInBackground
```xml
@@ -128,9 +142,9 @@ Whether to use a dark styled keyboard on iOS
* The default origin for requests from the Android WebView is `http://localhost`. If `Hostname` and `Scheme` preferences are set, then origin will be `schemeValue://HostnameValue`.
-1. Apps are now served from `ionic://` scheme on iOS.
+1. Apps are now served from `ionic://` scheme on iOS by default.
- * The default origin for requests from the iOS WebView is `ionic://localhost`. If `Hostname` preference is set, then origin will be `ionic://HostnameValue`.
+ * The default origin for requests from the iOS WebView is `ionic://localhost`. If `Hostname` and `iosScheme` preferences are set, then origin will be `iosSchemeValue://HostnameValue`.
1. Replace any usages of `window.Ionic.normalizeURL()` with `window.Ionic.WebView.convertFileSrc()`.
diff --git a/src/ios/CDVWKWebViewEngine.h b/src/ios/CDVWKWebViewEngine.h
index b222b09b..9dd7b24c 100644
--- a/src/ios/CDVWKWebViewEngine.h
+++ b/src/ios/CDVWKWebViewEngine.h
@@ -25,8 +25,6 @@
@property (nonatomic, strong, readonly) id uiDelegate;
@property (nonatomic, strong) NSString * basePath;
-extern NSString * const IONIC_SCHEME;
-
-(void)setServerBasePath:(CDVInvokedUrlCommand*)command;
-(void)getServerBasePath:(CDVInvokedUrlCommand*)command;
diff --git a/src/ios/CDVWKWebViewEngine.m b/src/ios/CDVWKWebViewEngine.m
index feba94b5..3b048204 100644
--- a/src/ios/CDVWKWebViewEngine.m
+++ b/src/ios/CDVWKWebViewEngine.m
@@ -118,8 +118,6 @@ @implementation CDVWKWebViewEngine
NSTimer *timer;
-NSString * const IONIC_SCHEME = @"ionic";
-
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super init];
@@ -197,7 +195,11 @@ - (void)pluginInitialize
if(bind == nil){
bind = @"localhost";
}
- self.CDV_LOCAL_SERVER = [NSString stringWithFormat:@"%@://%@",IONIC_SCHEME, bind];
+ NSString *scheme = [settings cordovaSettingForKey:@"iosScheme"];
+ if(scheme == nil || [scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"] || [scheme isEqualToString:@"file"]){
+ scheme = @"ionic";
+ }
+ self.CDV_LOCAL_SERVER = [NSString stringWithFormat:@"%@://%@", scheme, bind];
self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
@@ -238,9 +240,9 @@ - (void)pluginInitialize
WKWebViewConfiguration* configuration = [self createConfigurationFromSettings:settings];
configuration.userContentController = userContentController;
- self.handler = [[IONAssetHandler alloc] init];
- [self.handler setAssetPath:[self getStartPath]];
- [configuration setURLSchemeHandler:self.handler forURLScheme:IONIC_SCHEME];
+ self.handler = [[IONAssetHandler alloc] initWithBasePath:[self getStartPath] andScheme:scheme];
+ NSLog(@"voy a usar el scheme %@", scheme);
+ [configuration setURLSchemeHandler:self.handler forURLScheme:scheme];
// re-create WKWebView, since we need to update configuration
// remove from keyWindow before recreating
diff --git a/src/ios/IONAssetHandler.h b/src/ios/IONAssetHandler.h
index 61cab670..aee8d1c7 100644
--- a/src/ios/IONAssetHandler.h
+++ b/src/ios/IONAssetHandler.h
@@ -4,7 +4,10 @@
@interface IONAssetHandler : NSObject
@property (nonatomic, strong) NSString * basePath;
+@property (nonatomic, strong) NSString * scheme;
-(void)setAssetPath:(NSString *)assetPath;
+- (instancetype)initWithBasePath:(NSString *)basePath andScheme:(NSString *)scheme;
+
@end
diff --git a/src/ios/IONAssetHandler.m b/src/ios/IONAssetHandler.m
index f7794c4d..52135fa3 100644
--- a/src/ios/IONAssetHandler.m
+++ b/src/ios/IONAssetHandler.m
@@ -8,6 +8,15 @@ -(void)setAssetPath:(NSString *)assetPath {
self.basePath = assetPath;
}
+- (instancetype)initWithBasePath:(NSString *)basePath andScheme:(NSString *)scheme {
+ self = [super init];
+ if (self) {
+ _basePath = basePath;
+ _scheme = scheme;
+ }
+ return self;
+}
+
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id )urlSchemeTask
{
NSString * startPath = @"";
@@ -15,7 +24,7 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id )ur
NSString * stringToLoad = url.path;
NSString * scheme = url.scheme;
- if ([scheme isEqualToString:IONIC_SCHEME]) {
+ if ([scheme isEqualToString:self.scheme]) {
if ([stringToLoad hasPrefix:@"/_app_file_"]) {
startPath = [stringToLoad stringByReplacingOccurrencesOfString:@"/_app_file_" withString:@""];
} else {