2011-10-31 62 views
2

我有webview內滾動視圖,並且該滾動視圖也在另一個滾動(頁面控制)內。IOS模擬器5 webview錯誤:CALayerInvalidGeometry

我的問題是我得到這個以下錯誤

This is the error: 
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]' 
*** First throw call stack: 
(0x1583052 0x196cd0a 0x152ba78 0x152b9e9 0x4c9de99 0x4c94205 0x233ebb3 0x76598e 0x96d495  0x764a5e 0x1584e1a 0x14ee821 0x622349 0x60ead4 0x615bee 0x6194e6 0x88de39 0x88d143 0x88e3cf 0x890a31 0x89098c 0x8893e7 0x5f1812 0x5f1ba2 0x5d8384 0x5cbaa9 0x20b1fa9 0x15571c5 0x14bc022 0x14ba90a 0x14b9db4 0x14b9ccb 0x20b0879 0x20b093e 0x5c9a9b 0x302d 0x2895) 
terminate called throwing an exceptionCurrent language: auto; currently objective-c 

這是我的代碼,我認爲這個問題(因爲如果我評論blogThumbnailWebview的loadRequest:。請求]這是工作的罰款沒有錯誤

- (void) setVideoAsThumbnail:(NSString *)videoThumbnailLink 
{ NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:videoThumbnailLink]]; 
blogThumbnailWebView .scalesPageToFit = NO; 
[blogThumbnailWebView loadRequest:request]; 
blogThumbnailWebView.allowsInlineMediaPlayback = NO; 
} 

但是誤差僅在模擬器5,如果我使用模擬器4.3沒有錯誤。

我該如何解決呢?

FYI:IM使用ARC,和Xcode的4.2 SDK 5

回答

2

當初始化web視圖,請確保您不使用純初始化方法,而是一個像initWithFrame。通過使用簡單的初始化,有時在使用組件時不會分配幀,因此會拋出CALayerInvalidGeometry錯誤。

+0

這是正確的。 +1 – SmallChess