0
私はパスウェイを取得するためにNSStringとパスを保存するためにNSStringを使用してMacOS 10.12のビデオスクリーンセーバーを作成しようとしています。NSStringパスは、ファイルがフォルダに含まれているにもかかわらず常にnilを返します
しかし、私は、スクリーンセーバーをテストするたびに、それがこのエラーでクラッシュ:
Application Specific Information:
com.apple.preference.desktopscreeneffect v.5.1 (Desktop & Screen Saver)
Crashing on exception: *** -[NSURL initFileURLWithPath:]: nil string parameter
私は、問題はここにあると信じて:
// Create the video path then use it. (Problem at the moment: the pathway always returns nil)
NSString *screenSaverPath = [[NSBundle mainBundle] pathForResource:@"apple" ofType:@"mp4"];
NSURL *screenSaver = [NSURL fileURLWithPath:screenSaverPath];
//Obtain the size of the screen.
NSSize size = [self bounds].size;
//Draw the video player.
AVPlayer *video = [AVPlayer playerWithURL:screenSaver];
しかし、私は取り組むことができますどのようになどわかりませんよこの問題。あなたはこの問題を解決する方法について誰もが知っていますか?ありがとうございました!
"plugin"とはどういう意味ですか? pathForResourceとofTypeコードなどを参照していますか? – coolmanbat1
あなたはスクリーンセーバーを書いていると言っています...?それらはシステムによってロードされるプラグインです。 – uliwitness
ああそうです。うん、私はxcodeでスクリーンセーバーを作っているのはかなり驚きです。 – coolmanbat1