如何在单元格中设置当前用户?迅捷,解析 [英] How to set the current user in cell? Swift, Parse

查看:122
本文介绍了如何在单元格中设置当前用户?迅捷,解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

天,伙计们.帮帮我.我三天不能解决问题

Day, guys. Help me.I can not solve the problem for three days

我使应用看起来像Instagram.我想确保在创建帖子时,在表格视图的单元格中写下他的昵称.

I make an app look like an Instagram. I want to make sure that when you create a post, in cell of tableview, writing his nickname.

我正在尝试:

findSweeter.findObjectsInBackgroundWithBlock{
        (objects:[AnyObject]?, error:NSError?)->Void in
        if error == nil{
            let user:PFUser = (objects as NSArray).lastObject  as PFUser!
            cell1.usernamelabel.text = user.username
        }
    }
}

但这就是问题:[AnyObject]?不能转换为'NSArray'& "NSArray无法转换为PFUser"

But thats issue: [AnyObject]? is not convertible to 'NSArray' & 'NSArray is not convertible to PFUser'

帮助,请.我正在使用Parse.com

Help, pls. im using Parse.com

推荐答案

我很轻松地解决了我的问题.我只是将解析凝结的数据"中的PFUser变量更改为String:

I solved my problem so easly. I just changed PFUser variable in Data on Parse Clotd to String:

cell1.usernamelabel.text = sweet.objectForKey("usa") as? String

这篇关于如何在单元格中设置当前用户?迅捷,解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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