在iOS上与youtube-ios-player-helper第三方库集成时出错

Ash*_*ani 13 youtube ios youtube-iframe-api

我正在尝试使用youtube-ios-player-helper库播放YouTube视频,但我在运行时遇到错误:

Received error rendering template: Error Domain=NSCocoaErrorDomain Code=258 "The operation couldn't be completed. (Cocoa error 258.)"
Run Code Online (Sandbox Code Playgroud)

Lov*_*and 40

在YTPlayerView.m中

编辑:

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"
                                            inDirectory:@"Assets"];
Run Code Online (Sandbox Code Playgroud)

至:

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
                                                 ofType:@"html"];
Run Code Online (Sandbox Code Playgroud)

希望能帮到你!

  • 改变但仍然得到*Cocoa错误258.* (7认同)
  • 谢谢,它节省了我很多时间. (2认同)

Ján*_*nos 6

您需要 Assets/YTPlayerView-iframe-player.html复制到主包以解决此问题.

或者只是放入捆绑包,并替换App开始寻找的地方

/*NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player"
     ofType:@"html"
     inDirectory:@"Assets"];*/

NSString *path = [[NSBundle mainBundle] pathForResource:@"YTPlayerView-iframe-player" ofType:@"html"];
Run Code Online (Sandbox Code Playgroud)