2016-02-29 72 views
0

當頁面加載時,我想在UIWebView(iOS 9.2.1)上播放m3u8鏈接時按下時會出現quickTime播放器的播放圖標(僅限於iPhone設備)玩家填滿所有的屏幕和日誌給出了這樣的警告:QuickTime播放器UIWebView上的iOS 9在播放按下後發出警告

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
Stack:(
    0 CoreFoundation      0x23e74123 <redacted> + 150 
    1 libobjc.A.dylib      0x2361ae17 objc_exception_throw + 38 
    2 CoreFoundation      0x23e74051 <redacted> + 0 
    3 Foundation       0x24754acb <redacted> + 170 
    4 Foundation       0x245fa3bf <redacted> + 38 
    5 UIKit        0x280b69d5 <redacted> + 52 
    6 UIKit        0x280b73bb <redacted> + 222 
    7 UIKit        0x287d0293 <redacted> + 322 
    8 UIKit        0x282b155d <redacted> + 148 
    9 UIKit        0x27facd13 <redacted> + 714 
    10 QuartzCore       0x260abf99 <redacted> + 128 
    11 QuartzCore       0x260a7695 <redacted> + 348 
    12 QuartzCore       0x260a7529 <redacted> + 16 
    13 QuartzCore       0x260a6a49 <redacted> + 368 
    14 QuartzCore       0x260a66fb <redacted> + 614 
    15 WebCore        0x27b7a61b <redacted> + 274 
    16 CoreFoundation      0x23e3768f <redacted> + 14 
    17 CoreFoundation      0x23e3727d <redacted> + 452 
    18 CoreFoundation      0x23e355eb <redacted> + 794 
    19 CoreFoundation      0x23d88bf9 CFRunLoopRunSpecific + 520 
    20 CoreFoundation      0x23d889e5 CFRunLoopRunInMode + 108 
    21 WebCore        0x2713547f <redacted> + 422 
    22 libsystem_pthread.dylib    0x23bad85b <redacted> + 138 
    23 libsystem_pthread.dylib    0x23bad7cf _pthread_start + 110 
    24 libsystem_pthread.dylib    0x23bab724 thread_start + 8 
) 
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
Stack:(
    0 CoreFoundation      0x23e74123 <redacted> + 150 
    1 libobjc.A.dylib      0x2361ae17 objc_exception_throw + 38 
    2 CoreFoundation      0x23e74051 <redacted> + 0 
    3 Foundation       0x24754acb <redacted> + 170 
    4 Foundation       0x245fa3bf <redacted> + 38 
    5 UIKit        0x280b69d5 <redacted> + 52 
    6 UIKit        0x287cfc89 <redacted> + 132 
    7 UIKit        0x280b76bf <redacted> + 86 
    8 Foundation       0x245fa499 <redacted> + 256 
    9 UIKit        0x280b69d5 <redacted> + 52 
    10 UIKit        0x280b73bb <redacted> + 222 
    11 UIKit        0x287d0293 <redacted> + 322 
    12 UIKit        0x282b155d <redacted> + 148 
    13 UIKit        0x27facd13 <redacted> + 714 
    14 QuartzCore       0x260abf99 <redacted> + 128 
    15 QuartzCore       0x260a7695 <redacted> + 348 
    16 QuartzCore       0x260a7529 <redacted> + 16 
    17 QuartzCore       0x260a6a49 <redacted> + 368 
    18 QuartzCore       0x260a66fb <redacted> + 614 
    19 WebCore        0x27b7a61b <redacted> + 274 
    20 CoreFoundation      0x23e3768f <redacted> + 14 
    21 CoreFoundation      0x23e3727d <redacted> + 452 
    22 CoreFoundation      0x23e355eb <redacted> + 794 
    23 CoreFoundation      0x23d88bf9 CFRunLoopRunSpecific + 520 
    24 CoreFoundation      0x23d889e5 CFRunLoopRunInMode + 108 
    25 WebCore        0x2713547f <redacted> + 422 
    26 libsystem_pthread.dylib    0x23bad85b <redacted> + 138 
    27 libsystem_pthread.dylib    0x23bad7cf _pthread_start + 110 
    28 libsystem_pthread.dylib    0x23bab724 thread_start + 8 
) 
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 
Stack:(
    0 CoreFoundation      0x23e74123 <redacted> + 150 
    1 libobjc.A.dylib      0x2361ae17 objc_exception_throw + 38 
    2 CoreFoundation      0x23e74051 <redacted> + 0 
    3 Foundation       0x24754acb <redacted> + 170 
    4 Foundation       0x245fe877 <redacted> + 38 
    5 Foundation       0x245fa503 <redacted> + 362 
    6 UIKit        0x280b69d5 <redacted> + 52 
    7 UIKit        0x280b73bb <redacted> + 222 
    8 UIKit        0x287d0293 <redacted> + 322 
    9 UIKit        0x282b155d <redacted> + 148 
    10 UIKit        0x27facd13 <redacted> + 714 
    11 QuartzCore       0x260abf99 <redacted> + 128 
    12 QuartzCore       0x260a7695 <redacted> + 348 
    13 QuartzCore       0x260a7529 <redacted> + 16 
    14 QuartzCore       0x260a6a49 <redacted> + 368 
    15 QuartzCore       0x260a66fb <redacted> + 614 
    16 WebCore        0x27b7a61b <redacted> + 274 
    17 CoreFoundation      0x23e3768f <redacted> + 14 
    18 CoreFoundation      0x23e3727d <redacted> + 452 
    19 CoreFoundation      0x23e355eb <redacted> + 794 
    20 CoreFoundation      0x23d88bf9 CFRunLoopRunSpecific + 520 
    21 CoreFoundation      0x23d889e5 CFRunLoopRunInMode + 108 
    22 WebCore        0x2713547f <redacted> + 422 
    23 libsystem_pthread.dylib    0x23bad85b <redacted> + 138 
    24 libsystem_pthread.dylib    0x23bad7cf _pthread_start + 110 
    25 libsystem_pthread.dylib    0x23bab724 thread_start + 8 
) 

這不會對任何iPad設備僅適用於iPhone的人出現。

即使試圖在一個「瘦」應用程序仍然相同的警告,我用在UIWebView中的負載要求:

dispatch_async(dispatch_get_main_queue(), ^{ 
    NSString *rec = [_m3u8 string"]; 
    NSURL *url = [NSURL URLWithString:rec]; 
    NSURLRequest *request = [NSURLRequest requestWithURL:url]; 
    self.WebView.allowsInlineMediaPlayback = YES; 
    [self.WebView loadRequest:request]; 
}); 

由於任何人誰幫助。

回答

0

好還是不UIWebView的很成功但有一個名爲「WKWebView」的對象是<WebKit/WebKit.h>的一部分來實現:

#import <WebKit/WebKit.h> 

然後在您的viewDidLoad等初始化:

WKWebView *w = [[WKWebView alloc]initWithFrame:self.view.bounds]; 
NSURL *url = [NSURL URLWithString:@"yourLink.m3u8"]; 
NSURLRequest *request = [NSURLRequest requestWithURL:url]; 
[w loadRequest:request]; 
[self.view addSubview:w]; 

還有一件事添加到您的.plist文件中:

App Transport Security Settings - Dictionary。

允許任意加載= YES。

它比UIWebView快得多,我沒有在日誌中看到上面提到的警告。

乾杯。