diff --git a/.changes/navigation-delegate-class-name-conflict.md b/.changes/navigation-delegate-class-name-conflict.md new file mode 100644 index 000000000..1b8f1aeb2 --- /dev/null +++ b/.changes/navigation-delegate-class-name-conflict.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Change class declare name from `UIViewController` to `WryNavigationDelegate` to avoid class name conflict on iOS. diff --git a/src/webview/wkwebview/mod.rs b/src/webview/wkwebview/mod.rs index 668a17a5e..c4859b763 100644 --- a/src/webview/wkwebview/mod.rs +++ b/src/webview/wkwebview/mod.rs @@ -468,7 +468,8 @@ impl InnerWebView { let pending_scripts = Arc::new(Mutex::new(Some(Vec::new()))); - let navigation_delegate_cls = match ClassDecl::new("UIViewController", class!(NSObject)) { + let navigation_delegate_cls = match ClassDecl::new("WryNavigationDelegate", class!(NSObject)) + { Some(mut cls) => { cls.add_ivar::<*mut c_void>("pending_scripts"); cls.add_ivar::<*mut c_void>("navigation_policy_function"); @@ -488,7 +489,7 @@ impl InnerWebView { add_download_methods(&mut cls); cls.register() } - None => class!(UIViewController), + None => class!(WryNavigationDelegate), }; let navigation_policy_handler: id = msg_send![navigation_delegate_cls, new];