タイトルの通り、公式Twitterで複数画像が添付出来るようになりましたね。
ということでちょっと調べてみました。
このようにタイムライン上に複数枚が表示されるようになりました。
サードパーティはこの機能が使えるのか?
1.送信側
objc
SLRequest *postRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:[NSURL URLWithString:MediaUpload_URL] parameters:nil];
NSData *myData = [tweet dataUsingEncoding:NSUTF8StringEncoding];
NSData*media = [NSKeyedArchiver archivedDataWithRootObject:@[UIImageJPEGRepresentation(image,0.5),UIImageJPEGRepresentation(image,0.5)];
[postRequest addMultipartData:media withName:@"media[]" type:@"multipart/jpg" filename:nil];
[postRequest addMultipartData:myData withName:@"status" type:@"text/plain" filename:nil];
[postRequest setAccount:twitterAccount];
[self performSelectorOnMainThread:@selector(startConnectionWithRequest:)
withObject:postRequest.preparedURLRequest
waitUntilDone:NO];
結果→無理だった\(^o^)/
NSData*media周りが間違えている気もしなくもないんですが、これでいいんかな(という不安)
2.受信側
じゃ、じゃあ表示だけでも対応しようぜ!!
{
contributors = "<null>";
coordinates = "<null>";
"created_at" = "Fri Mar 28 02:10:23 +0000 2014";
dltime = "11:10:23";
entities = {
hashtags = (
);
media = (
{
"display_url" = "pic.twitter.com/lDdjy3m78t";
"expanded_url" = "http://twitter.com/noppefoxwolf/status/449367867583000576/photo/1";
id = 449367837828583424;
"id_str" = 449367837828583424;
indices = (
4,
26
);
"media_url" = "http://pbs.twimg.com/media/Bjx5qutCEAApb2i.jpg";
"media_url_https" = "https://pbs.twimg.com/media/Bjx5qutCEAApb2i.jpg";
sizes = {
large = {
h = 731;
resize = fit;
w = 1024;
};
medium = {
h = 428;
resize = fit;
w = 599;
};
small = {
h = 242;
resize = fit;
w = 340;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "http://t.co/lDdjy3m78t";
}
);
symbols = (
);
urls = (
);
"user_mentions" = (
);
};
"favorite_count" = 9;
favorited = 0;
geo = "<null>";
id = 449367867583000576;
"id_str" = 449367867583000576;
"in_reply_to_screen_name" = "<null>";
"in_reply_to_status_id" = "<null>";
"in_reply_to_status_id_str" = "<null>";
"in_reply_to_user_id" = "<null>";
"in_reply_to_user_id_str" = "<null>";
lang = ja;
place = "<null>";
"possibly_sensitive" = 0;
"retweet_count" = 6;
retweeted = 0;
source = "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>";
text = "\U30c6\U30b9\U30c8 ";
truncated = 0;
user = {
"contributors_enabled" = 0;
"created_at" = "Wed Dec 10 14:51:39 +0000 2008";
"default_profile" = 0;
"default_profile_image" = 0;
description = "\U591c\U72d0\U516b\U91cd\U594f\U306e\U958b\U767a\U8005\U3002";
entities = {
description = {
urls = (
);
};
url = {
urls = (
{
"display_url" = "bit.ly/nightfoxduo";
"expanded_url" = "http://bit.ly/nightfoxduo";
indices = (
0,
22
);
url = "http://t.co/nj5cYQTFsx";
}
);
};
};
"favourites_count" = 6932;
"follow_request_sent" = 0;
"followers_count" = 4652;
following = 0;
"friends_count" = 49;
"geo_enabled" = 1;
id = 18020556;
"id_str" = 18020556;
"is_translation_enabled" = 0;
"is_translator" = 0;
lang = ja;
"listed_count" = 187;
location = noppelab;
name = "noppe*";
notifications = 0;
"profile_background_color" = 000000;
"profile_background_image_url" = "http://pbs.twimg.com/profile_background_images/378800000044232845/23d966b12126556d7e83419bea4f067c.png";
"profile_background_image_url_https" = "https://pbs.twimg.com/profile_background_images/378800000044232845/23d966b12126556d7e83419bea4f067c.png";
"profile_background_tile" = 0;
"profile_banner_url" = "https://pbs.twimg.com/profile_banners/18020556/1392426820";
"profile_image_url" = "http://pbs.twimg.com/profile_images/434495624570871810/sJoHfZnY_normal.jpeg";
"profile_image_url_https" = "https://pbs.twimg.com/profile_images/434495624570871810/sJoHfZnY_normal.jpeg";
"profile_link_color" = 666666;
"profile_sidebar_border_color" = FFFFFF;
"profile_sidebar_fill_color" = 121212;
"profile_text_color" = 990000;
"profile_use_background_image" = 1;
protected = 0;
"screen_name" = noppefoxwolf;
"statuses_count" = 91443;
"time_zone" = Tokyo;
url = "http://t.co/nj5cYQTFsx";
"utc_offset" = 32400;
verified = 0;
};
}
最初の写真しか入ってない。\(^o^)/
3.受信側
じゃ、じゃあアレや!アレでアレや!!!
{
contributors = "<null>";
"conversation_id" = 449367867583000576;
coordinates = "<null>";
"created_at" = "Fri Mar 28 02:10:23 +0000 2014";
dltime = "11:10:23";
entities = {
hashtags = (
);
media = (
{
"display_url" = "pic.twitter.com/lDdjy3m78t";
"expanded_url" = "http://twitter.com/noppefoxwolf/status/449367867583000576/photo/1";
features = {
large = {
faces = (
{
h = 221;
w = 221;
x = 104;
y = 162;
}
);
};
medium = {
faces = (
{
h = 129;
w = 129;
x = 60;
y = 94;
}
);
};
small = {
faces = (
{
h = 73;
w = 73;
x = 34;
y = 53;
}
);
};
};
id = 449367837828583424;
"id_str" = 449367837828583424;
indices = (
4,
26
);
"media_url" = "http://pbs.twimg.com/media/Bjx5qutCEAApb2i.jpg";
"media_url_https" = "https://pbs.twimg.com/media/Bjx5qutCEAApb2i.jpg";
sizes = {
large = {
h = 731;
resize = fit;
w = 1024;
};
medium = {
h = 428;
resize = fit;
w = 599;
};
small = {
h = 242;
resize = fit;
w = 340;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "http://t.co/lDdjy3m78t";
},
{
"display_url" = "pic.twitter.com/lDdjy3m78t";
"expanded_url" = "http://twitter.com/noppefoxwolf/status/449367867583000576/photo/1";
features = {
large = {
faces = (
);
};
medium = {
faces = (
);
};
small = {
faces = (
);
};
};
id = 449367839074291713;
"id_str" = 449367839074291713;
indices = (
4,
26
);
"media_url" = "http://pbs.twimg.com/media/Bjx5qzWCEAEYk6M.jpg";
"media_url_https" = "https://pbs.twimg.com/media/Bjx5qzWCEAEYk6M.jpg";
sizes = {
large = {
h = 768;
resize = fit;
w = 1024;
};
medium = {
h = 450;
resize = fit;
w = 600;
};
small = {
h = 255;
resize = fit;
w = 340;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "http://t.co/lDdjy3m78t";
},
{
"display_url" = "pic.twitter.com/lDdjy3m78t";
"expanded_url" = "http://twitter.com/noppefoxwolf/status/449367867583000576/photo/1";
features = {
large = {
faces = (
);
};
medium = {
faces = (
);
};
small = {
faces = (
);
};
};
id = 449367838994595840;
"id_str" = 449367838994595840;
indices = (
4,
26
);
"media_url" = "http://pbs.twimg.com/media/Bjx5qzDCAAAKdU6.jpg";
"media_url_https" = "https://pbs.twimg.com/media/Bjx5qzDCAAAKdU6.jpg";
sizes = {
large = {
h = 768;
resize = fit;
w = 1024;
};
medium = {
h = 450;
resize = fit;
w = 600;
};
small = {
h = 255;
resize = fit;
w = 340;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "http://t.co/lDdjy3m78t";
},
{
"display_url" = "pic.twitter.com/lDdjy3m78t";
"expanded_url" = "http://twitter.com/noppefoxwolf/status/449367867583000576/photo/1";
features = {
large = {
faces = (
);
};
medium = {
faces = (
);
};
small = {
faces = (
);
};
};
id = 449367864890232832;
"id_str" = 449367864890232832;
indices = (
4,
26
);
"media_url" = "http://pbs.twimg.com/media/Bjx5sThCEAAv_cZ.jpg";
"media_url_https" = "https://pbs.twimg.com/media/Bjx5sThCEAAv_cZ.jpg";
sizes = {
large = {
h = 1024;
resize = fit;
w = 768;
};
medium = {
h = 800;
resize = fit;
w = 600;
};
small = {
h = 453;
resize = fit;
w = 340;
};
thumb = {
h = 150;
resize = crop;
w = 150;
};
};
type = photo;
url = "http://t.co/lDdjy3m78t";
}
);
symbols = (
);
urls = (
);
"user_mentions" = (
);
};
"favorite_count" = 9;
favorited = 0;
geo = "<null>";
id = 449367867583000576;
"id_str" = 449367867583000576;
"in_reply_to_screen_name" = "<null>";
"in_reply_to_status_id" = "<null>";
"in_reply_to_status_id_str" = "<null>";
"in_reply_to_user_id" = "<null>";
"in_reply_to_user_id_str" = "<null>";
lang = ja;
place = "<null>";
"possibly_sensitive" = 0;
"retweet_count" = 7;
retweeted = 0;
source = "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>";
text = "\U30c6\U30b9\U30c8 ";
truncated = 0;
user = {
"can_media_tag" = 1;
"contributors_enabled" = 0;
"created_at" = "Wed Dec 10 14:51:39 +0000 2008";
"default_profile" = 0;
"default_profile_image" = 0;
description = "\U591c\U72d0\U516b\U91cd\U594f\U306e\U958b\U767a\U8005\U3002";
entities = {
description = {
urls = (
);
};
url = {
urls = (
{
"display_url" = "bit.ly/nightfoxduo";
"expanded_url" = "http://bit.ly/nightfoxduo";
indices = (
0,
22
);
url = "http://t.co/nj5cYQTFsx";
}
);
};
};
"favourites_count" = 6932;
"follow_request_sent" = 0;
"followed_by" = 0;
"followers_count" = 4652;
following = 0;
"friends_count" = 49;
"geo_enabled" = 1;
id = 18020556;
"id_str" = 18020556;
"is_translation_enabled" = 0;
"is_translator" = 0;
lang = ja;
"listed_count" = 187;
location = noppelab;
"media_count" = 4493;
name = "noppe*";
notifications = 0;
"profile_background_color" = 000000;
"profile_background_image_url" = "http://pbs.twimg.com/profile_background_images/378800000044232845/23d966b12126556d7e83419bea4f067c.png";
"profile_background_image_url_https" = "https://pbs.twimg.com/profile_background_images/378800000044232845/23d966b12126556d7e83419bea4f067c.png";
"profile_background_tile" = 0;
"profile_banner_url" = "https://pbs.twimg.com/profile_banners/18020556/1392426820";
"profile_image_url" = "http://pbs.twimg.com/profile_images/434495624570871810/sJoHfZnY_normal.jpeg";
"profile_image_url_https" = "https://pbs.twimg.com/profile_images/434495624570871810/sJoHfZnY_normal.jpeg";
"profile_link_color" = 666666;
"profile_sidebar_border_color" = FFFFFF;
"profile_sidebar_fill_color" = 121212;
"profile_text_color" = 990000;
"profile_use_background_image" = 1;
protected = 0;
"screen_name" = noppefoxwolf;
"statuses_count" = 91443;
"time_zone" = Tokyo;
url = "http://t.co/nj5cYQTFsx";
"utc_offset" = 32400;
verified = 0;
};
}
キタコレ(´・ω・`)
どうやら、サードパーティ側は安定性の為なのか普通のトークンじゃあ送れないし受信も出来ないみたいですね…。