应用程式崩溃时,尝试通过Facebook iOS Graph API与应用范围的用户标识用户照片 [英] app crash when try get user photo by Facebook iOS Graph API with app-scoped user id
问题描述
2014-06-02 16:16:51.669 testapp [448:60b] - [NSNull dataUsingEncoding:]:无法识别选择器发送到实例0x19f8068
2014-06-02 16:16:51.679 testapp [448:60b] ***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [NSNull dataUsingEncoding: ]:无法识别的选择器发送到实例0x19f8068'
***首次调用堆栈:
(
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基础0x0138b7e1 __65- [NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] _ block_invoke + 62
15基础0x01213f5e - [NSURLConnectionInternalConnection invokeForDelegate:] + 119
16基础0x01213ec6 - [NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 208
17分配基金会0x01213dd8 - [NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 76
18分配基金会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 + 10 4
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 GraphicsSe rvices 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:以NSException类型的未捕获异常终止
(lldb)
谢谢!
我想这是因为你不处理如果您查询 / me / picture
,http重定向Facebook正在发送。如果您只想要图片的URL,请使用文档中所述的 / me / picture?redirect = false
: https://developers.facebook.com/docs/graph-api/reference/v2.0/用户/图片/#阅读
否则添加一些代码来处理http重定向。
I use Facebook for iOS. I get user's data without problem by Graph Api. From user's data I get app-scoped user id. Then I try get user's picture but application crashed. I tried use [FBRequestConnection startWithGraph:@"/me/picture" ...] and [FBRequestConnection startWithGraph:@"/(app id from user's data)/picture" ...] but still crashed. Why?
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)
Thanks!
I guess this is because you don't handle the http redirect Facebook is sending if you query /me/picture
. If you just want the URL of the picture, use /me/picture?redirect=false
as stated in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/picture/#read
Otherwise add some code to handle http redirects.
这篇关于应用程式崩溃时,尝试通过Facebook iOS Graph API与应用范围的用户标识用户照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!