2017-08-17 75 views
1

我是新來的目標c,但我有一個應用程序,我正在編譯,它在xcode 6上拋出錯誤。任何時候我點擊存檔構建失敗,並指向wkWebview.customUserAgent說在WKWebview類型上找不到對象類型customUserAgent的屬性。我已經梳理網絡尋找解決方案,但我找不到。我猜測customUserAgent沒有明確定義,我也不知道如何去做。我會欣賞任何指針。Sematice發行屬性「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;

請幫助。

回答

0

問題是您正在調用在最新版本的操作系統中定義的屬性。正如你所提到的,你正在使用Xcode 6,請使用Xcode 7+試試這個代碼。 Check Frameworks-> WebKit.framework-> Headers-> WKWebView.h-> Line 229

/*! @abstract如果自定義用戶代理字符串已設置,則自定義用戶代理字符串或nil。 */@property(可爲空,非原子,複製)NSString * customUserAgent API_AVAILABLE(macosx(10.11),ios(9.0));

+0

謝謝santak,但如果更新xcode不是一個選項,以任何方式呢? –

相關問題