Re: MLMediaLibrary sometimes does not call my KVO
Re: MLMediaLibrary sometimes does not call my KVO
- Subject: Re: MLMediaLibrary sometimes does not call my KVO
- From: Graham Cox <email@hidden>
- Date: Fri, 23 Sep 2016 09:09:35 +1000
> On 22 Sep 2016, at 10:45 PM, Gabriel Zachmann <email@hidden> wrote:
>
>> I’ve run into some unreliability in MLMediaLibrary. It appears to be a bug because it sometimes can be seen in places that use MLMediaLibrary within general standard components, such as NSOpenPanel (this adds a media browsing section if it is set up to allow image types, for example).
>
> Thanks a lot for your insights.
>
> I am wondering: how does Microsoft Word , for instance, do it?
> I've never seen that application behave funny when it shows the image browser (it faithfully shows all 10,000 images from my Photos library).
>
> Does it use a different API?
It’s very hard for a sandboxed app to get access to the internals of Photos without using MLMediaLibrary, though not too difficult for non-sandboxed. MLMediaLibrary was added because of this need.
There is a standard component - NSMediaLibraryBrowserController (https://developer.apple.com/reference/appkit/nsmedialibrarybrowsercontroller?language=objc) that gives you a standardised panel for browsing. Unfortunately it’s a standalone panel rather than a view that you can embed within a larger UI, but it’s sufficient for many needs, and is easy to use. You could look at that and see if its behaviour is more reliable than your own code. I have tried it and it isn’t for me - I get the same problems with it that I see in NSOpenPanel, or when using KVO on MLMediaLibrary elements, which is why the problem seems to be in the lower-level layers of MLMediaLibrary.
—Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden