gpt4 book ai didi

ios - 在标签上打印 Instagram 帖子回复时出现问题

转载 作者:行者123 更新时间:2023-11-30 11:16:00 26 4
gpt4 key购买 nike

我收到了 Instagram 帖子回复,但从中我将数组放入对象中,我的意思是主数组是数据,并且我有对象用户,并且我想打印 full_name 这是响应

回应

SUCCESS: {
data = (
{
attribution = "<null>";
caption = {
"created_time" = 1533621008;
from = {
"full_name" = "Mike Alpha";
id = 8376082973;
"profile_picture" = "";
username = mikealpha607;
};
id = 17952863989106568;
text = Hi;
};
comments = {
count = 1;
};
"created_time" = 1533621008;
filter = Normal;
id = "1840468872962982375_8376082973";
images = {
"low_resolution" = {
height = 320;
url = "";
width = 320;
};
"standard_resolution" = {
height = 640;
url = "https://scontent.cdninstagram.com/vp/adcc206df693d4d65c9b6f6b5ef7a016/5C024385/t51.2885-15/sh0.08/e35/s640x640/37867466_267564047306571_7531604489342550016_n.jpg";
width = 640;
};
thumbnail = {
height = 150;
url = "";
width = 150;
};
};
likes = {
count = 2;
};
link = "https://www.instagram.com/p/BmKqLBRH0Hn/";
location = {
id = 761100677398542;
latitude = "23.102652628869";
longitude = "72.595614227203";
name = "PVR Cinemas, Motera, Ahmedabad";
};
tags = (
);
type = image;
user = {
"full_name" = "Mike Alpha";
id = 8376082973;
"profile_picture" = "";
username = mikealpha607;
};
"user_has_liked" = 1;
"users_in_photo" = (
);
}

我正在获取用户对象,但不明白如何在标签上打印让我显示我的代码

代码

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TestTableViewCell

let createdTime = serviceData[indexPath.row]["created_time"]
let timeinterval : TimeInterval = (createdTime as! NSString).doubleValue
let dateFromServer = NSDate(timeIntervalSince1970:timeinterval)
let dateFormater : DateFormatter = DateFormatter()
dateFormater.dateFormat = "dd MMM yyyy"
cell.lblDate.text = dateFormater.string(from: dateFromServer as Date)


let instaResponse = serviceData[indexPath.row]["user"]
print(instaResponse) **Here I am getting user object response but i understand how to print on label**
return cell
}

请帮助我理解这一点

请检查这个新问题

    let imagePosts = serviceData[indexPath.row]["images"] as! [String:Any]
let instaImage = imagePosts["standard_resolution"]
let proimgurl1 = NSURL(string: instaImage as! String)
cell.imgPost.image = UIImage(data: NSData(contentsOf: proimgurl1! as URL)! as Data)

我正在获取 imageurl,但是当我传递到 ImageView 时,它会崩溃

最佳答案

你可以试试

let instaResponse = serviceData[indexPath.row]["user"] as! [String:Any]
let fName = instaResponse["full_name"] as! String
cell.fnameLbl.text = fName // suppose outlet is fnameLbl
printfName)

//

let imagePosts = serviceData[indexPath.row]["images"] as! [String:[String:Any]]
let instaImage = imagePosts["standard_resolution"]["url"] as! String

关于ios - 在标签上打印 Instagram 帖子回复时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51745053/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com