gpt4 book ai didi

ios - 无法在 TableView 中的标签上打印 Twitter 响应

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

我收到了 twitter v 11 api 响应,并且填充了我的数组,但是我无法在 tableview 上打印,这是响应

[(Swift.ImplicitlyUnwrappedOptional<Any>.some(<__NSArrayM 0x600000842520>(
{
contributors = "";
coordinates = "";
"created_at" = "Thu Jul 12 11:49:57 +0000 2018";
entities = {
hashtags = (
);
media = (
{
"display_url" = "pic.twitter.com/IJtq6aLM7K";
"expanded_url" = "";
id = 1017375504448479232;
"id_str" = 1017375504448479232;
indices = (
12,
35
);
"media_url" = "";
"media_url_https" = "";
sizes = {
large = {
h = 1820;
resize = fit;
w = 2048;
};
medium = {
h = 1067;
resize = fit;
w = 1200;
};
small = {
h = 604;
resize = fit;
w = 680;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "";
}
);
symbols = (
);
urls = (
);
"user_mentions" = (
);
};
"extended_entities" = {
media = (
{
"display_url" = "pic.twitter.com/IJtq6aLM7K";
"expanded_url" = "";
id = 1017375504448479232;
"id_str" = 1017375504448479232;
indices = (
12,
35
);
"media_url" = "";
"media_url_https" = "";
sizes = {
large = {
h = 1820;
resize = fit;
w = 2048;
};
medium = {
h = 1067;
resize = fit;
w = 1200;
};
small = {
h = 604;
resize = fit;
w = 680;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "";
}
);
};
"favorite_count" = 0;
favorited = 0;
geo = "";
id = 1017375507174719488;
"id_str" = 1017375507174719488;
"in_reply_to_screen_name" = "";
"in_reply_to_status_id" = "";
"in_reply_to_status_id_str" = "";
"in_reply_to_user_id" = "";
"in_reply_to_user_id_str" = "";
"is_quote_status" = 0;
lang = fr;
place = "";
"possibly_sensitive" = 0;
"retweet_count" = 0;
retweeted = 0;
source = "";
text = "Tweet Tweet";
truncated = 0;

这是我填充数组的代码

从这段代码中我得到了响应

var timeline = (FHSTwitterEngine.shared().getTimelineForUser(FHSTwitterEngine.shared().authenticatedUsername, isID: true, count: 10), terminator: "")

现在我像这样填充我的数组

 var serviceData : [AnyObject]=[]
let timelinedata = [timeline] as [AnyObject]
serviceData = (timelinedata)
print(serviceData)

我在服务数据中得到了完整的响应,现在我正在尝试在表格 View 中的标签上打印,如下所示

let retweerCount = serviceData[indexPath.row]["retweet_count"]
cell.lblRetweet.text = retweerCount as? String

坚果我无法打印任何人都可以给我解决这个问题

最佳答案

我认为retweerCount整数而不是字符串,所以使用下面的代码。

cell.lblRetweet.text = "\(retweerCount as? Int ?? 0)"

关于ios - 无法在 TableView 中的标签上打印 Twitter 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51587574/

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