我想在UIWebView(iOS 9.2.1)上播放m3u8链接 加载页面时,按下时会出现quickTime播放器的播放图标(仅在iPhone设备上),播放器填满所有屏幕,日志给出以下警告:
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];
});
感谢任何提供帮助的人。
UIWebView仍然没有取得多大成功,但是有一个名为"WKWebView"的对象是要实现<WebKit/WebKit.h>
的一部分:
#import <WebKit/WebKit.h>
然后在您的视图中初始化DidLoad 等:
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 文件中:
应用传输安全设置 - 字典。
允许任意载荷 = 是。
它比UIWebView快得多,而且我在日志中没有收到上面提到的警告。
干杯。