gpt4 book ai didi

ios - 尝试通过 Facebook iOS Graph API 使用应用范围的用户 ID 获取用户照片时应用崩溃

转载 作者:行者123 更新时间:2023-11-28 22:05:50 28 4
gpt4 key购买 nike

我使用 iOS 版 Facebook。我通过 Graph Api 毫无问题地获取了用户数据。从用户的数据中,我得到了应用范围的用户 ID。然后我尝试获取用户的图片,但应用程序崩溃了。我尝试使用 [FBRequestConnection startWithGraph:@"/me/picture"...] 和 [FBRequestConnection startWithGraph:@"/(app id from user's data)/picture"...] 但仍然崩溃。为什么?

   2014-06-02 16:16:51.669 testapp[448:60b] -[NSNull dataUsingEncoding:]: unrecognized selector sent to instance 0x19f8068

2014-06-02 16:16:51.679 testapp[448:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull dataUsingEncoding:]: unrecognized selector sent to instance 0x19f8068'

*** First throw call stack:

(
0 CoreFoundation 0x018ac1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0162b8e5 objc_exception_throw + 44
2 CoreFoundation 0x01949243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0189c50b ___forwarding___ + 1019
4 CoreFoundation 0x0189c0ee _CF_forwarding_prep_0 + 14
5 testapp 0x00022721 +[FBUtility simpleJSONDecode:error:] + 42
6 testapp 0x0000a75e -[FBRequestConnection parseJSONOrOtherwise:error:] + 69
7 testapp 0x0000a5a0 -[FBRequestConnection parseJSONResponse:error:statusCode:] + 1256
8 testapp 0x00009e04 -[FBRequestConnection completeWithResponse:data:orError:] + 666
9 testapp 0x00007564 __68-[FBRequestConnection startWithCacheIdentity:skipRoundtripIfCached:]_block_invoke + 201
10 testapp 0x00045fbc -[FBURLConnection invokeHandler:error:response:responseData:] + 49
11 testapp 0x00045ec7 -[FBURLConnection logAndInvokeHandler:response:responseData:] + 414
12 testapp 0x00046442 -[FBURLConnection connectionDidFinishLoading:] + 248
13 Foundation 0x013f4e49 ___NSURLConnectionDidFinishLoading_block_invoke + 40
14 Foundation 0x0138b7e1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 62
15 Foundation 0x01213f5e -[NSURLConnectionInternalConnection invokeForDelegate:] + 119
16 Foundation 0x01213ec6 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 208
17 Foundation 0x01213dd8 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 76
18 Foundation 0x01214188 _NSURLConnectionDidFinishLoading + 43
19 CFNetwork 0x064aa69f ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 111
20 CFNetwork 0x064a83de ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104
21 CoreFoundation 0x0184dc69 CFArrayApplyFunction + 57
22 CFNetwork 0x06411441 _ZN19RunloopBlockContext7performEv + 155
23 CFNetwork 0x064f33f4 _ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv + 20
24 CFNetwork 0x06411257 _ZN17MultiplexerSource7performEv + 299
25 CFNetwork 0x0641106c _ZN17MultiplexerSource8_performEPv + 76
26 CoreFoundation 0x0183577f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
27 CoreFoundation 0x0183510b __CFRunLoopDoSources0 + 235
28 CoreFoundation 0x018521ae __CFRunLoopRun + 910
29 CoreFoundation 0x018519d3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x018517eb CFRunLoopRunInMode + 123
31 GraphicsServices 0x038a05ee GSEventRunModal + 192
32 GraphicsServices 0x038a042b GSEventRun + 104
33 UIKit 0x002ebf9b UIApplicationMain + 1225
34 testapp 0x00003b2d main + 141
35 libdyld.dylib 0x01ef3701 start + 1
36 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

谢谢!

最佳答案

我想这是因为您没有处理 Facebook 在您查询 /me/picture 时发送的 http 重定向。如果您只想要图片的 URL,请按照文档中的说明使用 /me/picture?redirect=false:https://developers.facebook.com/docs/graph-api/reference/v2.0/user/picture/#read

否则添加一些代码来处理 http 重定向。

关于ios - 尝试通过 Facebook iOS Graph API 使用应用范围的用户 ID 获取用户照片时应用崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23994958/

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