gpt4 book ai didi

iOS 发布 Twitter 媒体崩溃

转载 作者:行者123 更新时间:2023-12-02 02:26:44 24 4
gpt4 key购买 nike

我正在尝试将图片从我的应用程序发布到 Twitter 帐户。它在我的 3 台设备上运行良好,但在我的一位 friend 上崩溃了。我正在使用以下代码..到目前为止已经浪费了近 2 天的时间,没有任何运气。请查看问题行,根据崩溃分析,应用程序在这两行上崩溃。有人经历过这种情况吗?

NSString *account_id = [PFUser currentUser][@"Twitter_ScreenName"];

NSURL *retweetURL = [NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/update_with_media.json"];
//Problem
NSDictionary *params = @{@"status" : [NSString stringWithFormat:@"%@#mytag",self.postTextView.text]};
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
requestMethod:SLRequestMethodPOST
URL:retweetURL
parameters:params];
NSData *imageData = UIImageJPEGRepresentation(self.postImage, 0.5f);
[request addMultipartData:imageData withName:@"media[]" type:@"image/jpeg" filename:@"image.jpg"];

ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

[account requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error)
{
if (granted == YES)//Problem
{
NSArray *twitterAccounts =
[account accountsWithAccountType:accountType];


if ([twitterAccounts count] > 0)
{
ACAccount *twitterAccount;

for (int i=0; i<[twitterAccounts count]; i++)
{
ACAccount *acc=[twitterAccounts objectAtIndex:i];
if ([acc.username isEqualToString: account_id ])
{
twitterAccount = acc;
break;

}
}

崩溃日志: 线程:致命异常:NSInvalidArgumentException0 CoreFoundation 0x2d8eaecb 异常预处理 + 1301 libobjc.A.dylib 0x38085ce7 objc_异常_抛出 + 382 CoreFoundation 0x2d8ee7f7 -[NSObject(NSObject) doesNotRecognizeSelector:] + 2023 核心基础 0x2d8ed0f7 ___转发_ + 7064 核心基础 0x2d83c058 _CF_forwarding_prep_0 + 245 MyApp 0x0011d425 44-[HMTagListViewController 按钮AddClicked:]_block_invoke_3 (HMTagListViewController.m:2475)6 libdispatch.dylib 0x38574b3b _dispatch_barrier_sync_f_slow_invoke + 707 libdispatch.dylib 0x3856ed3f _dispatch_client_callout + 228 libdispatch.dylib 0x385716c3 _dispatch_main_queue_callback_4CF + 2789 CoreFoundation 0x2d8b5641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 810 核心基础 0x2d8b3f0d __CFRunLoopRun + 130811 核心基础 0x2d81e729 CFRunLoopRunSpecific + 52412 核心基础 0x2d81e50b CFRunLoopRunInMode + 10613 图形服务 0x3278d6d3 GSEventRunModal + 13814 UIKit 0x3017f871 UIApplicationMain + 113615 我的应用程序 0x000edabf 主 (main.m:16)16 libdyld.dylib 0x38583ab7开始+2

====================

线程:SLRequest执行请求队列0 libsystem_kernel.dylib 0x38627aa0 semaphore_wait_trap + 81 libsystem_platform.dylib 0x3869ba0d _os_semaphore_wait + 122 libdispatch.dylib 0x38573513 _dispatch_barrier_sync_f_slow + 1383 MyApp 0x0011d31b __44-[HMTagListViewController 按钮AddClicked:]_block_invoke_21179 (HMTagListViewController.m:2461)4 社交 0x2ff74267 __39-[SLRequest PerformRequestWithHandler:]_block_invoke + 4105 libdispatch.dylib 0x3856ed53 _dispatch_call_block_and_release + 106 libdispatch.dylib 0x38573cbd _dispatch_queue_drain + 4887 libdispatch.dylib 0x38570c6f _dispatch_queue_invoke + 428 libdispatch.dylib 0x385745f1 _dispatch_root_queue_drain + 769 libdispatch.dylib 0x385748dd _dispatch_worker_thread2 + 5610 libsystem_pthread.dylib 0x3869fc17 _pthread_wqthread + 298

最佳答案

我最终碰巧创建了一个简单的应用程序,它只使用用户的 Twitter 帐户发布媒体。我能够确定这个问题,这是因为过期的 token 。用户的 Twitter 凭据不再准确。当他在“设置”中点击他的 Twitter 帐户时,我们收到了警报来证明这一点。一旦他重新输入警报,一切就开始工作了。现在它也可以在我的主应用程序中运行。

谢谢大家!

关于iOS 发布 Twitter 媒体崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25149503/

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