gpt4 book ai didi

ios - Twitter共享在iOS 7下是否中断? (附加示例项目。)

转载 作者:行者123 更新时间:2023-12-01 16:46:02 25 4
gpt4 key购买 nike

示例项目:http://cl.ly/261z1P100T25

在iOS 7下,当我尝试向推文中添加URL时,如果没有足够的空间添加该方法,则该方法应返回NO(“如果url不适合当前可用的字符空间,则此方法返回NO”),但是此方法在iOS 7中始终返回YES。例如,在以下示例中,“无法添加”。永远不会打印,并且会在推文中保留-32个字符。

SLComposeViewController *twitterViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
NSString *titleToShare = @"i am a string a super string the most super string that ever existed in the world of the super string universe which as it happens is very super as well";

if (titleToShare.length > 140) {
titleToShare = [titleToShare substringToIndex:140];
}

[twitterViewController setInitialText:titleToShare];

if (![twitterViewController addURL:[NSURL URLWithString:@"http://google.com"]]) {
NSLog(@"Couldn't add.");
}

[self presentViewController:twitterViewController animated:YES completion:nil];

坏了吗我必须对此编码吗?

最佳答案

它没有损坏,只是没有公开记录。我在代码中找到以下对setInitialText:方法的评论:

// Sets the initial text to be posted. Returns NO if the sheet has already been
// presented to the user. On iOS 6.x, this returns NO if the specified text
// will not fit within the character space currently available; on iOS 7.0 and
// later, you may supply text with a length greater than the service supports,
// and the sheet will allow the user to edit it accordingly.

因此,它们允许您设置大于140个字符的文本,只是您不能发布此文本,因为发布按钮已禁用。

关于ios - Twitter共享在iOS 7下是否中断? (附加示例项目。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19897168/

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