繁体   English   中英

在对象类型上找不到Sematice问题属性“ customUserAgent”

[英]Sematice Issue Property “customUserAgent” not found on object type

我对目标c还是陌生的,但是我正在编译一个应用程序,它在xcode 6上引发错误。每当我单击存档时,构建都会失败,并指向wkWebview.customUserAgent,说在对象类型customUserAgent上找不到属性WKWebview。 我已经在网上搜寻解决方案,但找不到。 我猜想customUserAgent没有明确定义,我也不只是不知道该怎么做。 我将不胜感激任何指针。

  // re-create WKWebView, since we need to update configuration WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration]; wkWebView.UIDelegate = self.uiDelegate; self.engineWebView = wkWebView; if (IsAtLeastiOSVersion(@"9.0") && [self.viewController isKindOfClass:[CDVViewController class]]) { wkWebView.customUserAgent = ((CDVViewController*) self.viewController).userAgent; 

请帮忙。

问题是您正在调用最新版本的OS中定义的属性。 如您所提到的,您正在使用Xcode 6,请在Xcode 7+上尝试使用此代码。 检查Frameworks-> WebKit.framework-> Headers-> WKWebView.h-> 229行

/ *! @abstract定制用户代理字符串,如果未设置定制用户代理字符串,则为nil。 * / @属性(可空,非原子,副本)NSString * customUserAgent API_AVAILABLE(macosx(10.11),ios(9.0));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM