URLForResource returns nil
I had a similar problem. The answer for me was to check the Target Membership of object's identity.
After some considerable digging and a smidgeon of luck I found that
NSURL *fileUrl = [[NSBundle mainBundle] URLForResource:@"embedded" withExtension:@"html"];
is incorrect and I should be using
NSURL *fileUrl = [[NSBundle bundleForClass:[self class]] URLForResource:@"embedded" withExtension:@"html"];
instead.
i.e. NSBundle bundleForClass:[self class] and not NSBundle mainBundle will give access to a screensaver bundle.
Might be obvious, but only if you know ;)
See Apple Developer NSBundle Class Reference