Get User Account Image

后端 未结 3 1065
故里飘歌
故里飘歌 2020-12-15 14:09

Simply: how do I get the user\'s account image?

I\'m using Cocoa on Mac.

3条回答
  •  难免孤独
    2020-12-15 14:38

    If you can get a handle to a CSIdentityRef or a CBIdentity* that represents the user in question, then you can invoke the -[CBIdentity image] method to retrieve their account image.

    Edit:

    Here's a previous answer of mine that shows how to query for all standard user accounts on a system and convert them into CBIdentity objects: Get all Users on OS X

    If you don't want to link against Collaboration.framework, then you can use something like CSIdentityImageGetData (or one of the similar variants) to get the image directly. I personally find working with a native Cocoa object to be nicer, but in this case it's not absolutely necessary.

提交回复
热议问题