On Feb 17, 2020, at 04:17:26, Gabriel Zachmann via Cocoa-dev 
<cocoa-dev@lists.apple.com> wrote:
> 
> One of my users (maybe, they others don't bother)
> told me that occasionally, they get an error message that must originate from 
> this piece of code in my screensaver:
> 
>    NSURL * url = [NSURL fileURLWithPath: [self absolutePathFor: filename_] 
> isDirectory: NO];
>    if ( url == NULL )
>    {
>       ...  // never happened so far
>    }
>    CGImageSourceRef sourceRef = CGImageSourceCreateWithURL( (CFURLRef) url, 
> NULL );
>    if ( sourceRef == NULL )
>    {
>        [self displayErrorMessage:  @"Image gone: " with: filename_];
>       ...
>    }
> 
> He gets the error message "Image gone" - but when he checks that path, the 
> image is there alright.
> 
> Does anyone have an idea what might be causing CGImageSourceCreateWithURL to 
> return NULL?
> Is there anything I can do to get to the bottom of this erratic behavior?

Does your screensaver need permission to access each folder or file? Does your 
screensaver have permission to use the Pictures folder (if that's the source of 
the images)? Do you save URLs in prefs? If so, do you store security scoped 
bookmarks, then resolve them on load, and have balanced calls to 
startAccessingSecurityScopedResource and stopAccessingSecurityScopedResource? 
Have you watched the console to see if any other info is being reported (filter 
on "screensaver" get both ScreenSaverEngine and legacyScreenSaver messages)?

--
Steve Mills
Drummer, Mac geek

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to