无法在 table 视图中的标签上打印 Twitter 回复
not able print twitter response on label in table view
我收到 twitter v 11 api 回复,我填满了我的数组,但是我无法在 table 上打印查看这里是回复
[(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)
我在服务数据中得到了完整的响应,现在我正在尝试在 table 视图中打印标签,如下所示
let retweerCount = serviceData[indexPath.row]["retweet_count"]
cell.lblRetweet.text = retweerCount as? String
nut 我无法打印任何人都可以给我解决方案吗
我认为 retweerCount
在 integer
而不是 string
所以使用下面的代码。
cell.lblRetweet.text = "\(retweerCount as? Int ?? 0)"
我收到 twitter v 11 api 回复,我填满了我的数组,但是我无法在 table 上打印查看这里是回复
[(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)
我在服务数据中得到了完整的响应,现在我正在尝试在 table 视图中打印标签,如下所示
let retweerCount = serviceData[indexPath.row]["retweet_count"]
cell.lblRetweet.text = retweerCount as? String
nut 我无法打印任何人都可以给我解决方案吗
我认为 retweerCount
在 integer
而不是 string
所以使用下面的代码。
cell.lblRetweet.text = "\(retweerCount as? Int ?? 0)"