怎么修改用户的昵称和头像,leancloud本身带昵称和头像吗,还是用自己服务器上的
-
创建时间
16年5月1日
-
最后回复
16年5月6日
-
8
回复
-
3.3K
浏览
-
2
用户
-
1
赞
import "AVUser+Avatar.h"
define kAttrKey_AvatarFile @"avatarFile"
@implementation AVUser (Avatar)
(NSString*)avatarUrl {
AVFile *avatarFile = [self objectForKey:kAttrKey_AvatarFile];
return [avatarFile url];
}
(void)updateAvatarWithImage:(UIImage*)image callback:(AVBooleanResultBlock)block{
AVFile *oldFile = [self objectForKey:kAttrKey_AvatarFile];
AVFile *newFile = [AVFile fileWithData:UIImagePNGRepresentation(image)];
[newFile saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
///失败
if (!succeeded) {
if (block) {
block(succeeded, error);
};
return;
}
///成功
[self setObject:newFile forKey:kAttrKey_AvatarFile];
[self saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
[oldFile deleteInBackground];
}
if (block) {
block(succeeded, error);
}
}];
}];
}
主题 | 分类 | 回复 | 浏览 | 活动 |
---|---|---|---|---|
会话中踢人、拉人操作一致性问题 | 实时通信 | 1 | 860 | 21-01-15 |
iOS创建群组会话返回错误 | 实时通信 | 20 | 2.2K | 16-01-23 |
从缓存获取查询最近对话时没有消息未读数据 | 实时通信 | 3 | 1.6K | 18-05-2 |
Android 如何创建系统对话 | 实时通信 | 5 | 1.1K | 16-08-26 |
发现 invalidTokens 的数量大于 0 是怎么回事? | 实时通信 | 0 | 755 | 16-07-14 |