获取用户帐户图像 [英] Get User Account Image

查看:94
本文介绍了获取用户帐户图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只需:我如何获得用户的帐户图片?

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

我在Mac上使用Cocoa。

I'm using Cocoa on Mac.

推荐答案

地址簿方法如果用户删除vcard ,则无效。

我使用不会中断的 CBIdentity 方法,如Dave所说:

I use the CBIdentity method that never breaks, as Dave says:

+ (NSImage *)userImage
{
    CBIdentity *identity = [CBIdentity identityWithName:NSUserName() authority:[CBIdentityAuthority defaultIdentityAuthority]];
    return [identity image];
}



为了使用CBIdentity,您需要添加 Collaboration Framework 到您的目标,并使用以下include指令

In order to use CBIdentity you need to add the Collaboration Framework to your targets and use the following include directive

#import <Collaboration/Collaboration.h>

这篇关于获取用户帐户图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆