[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKProfilePictureView CGImage]:
declare in .h file for facebook sdk integration 在.h文件中声明以进行Facebook sdk集成
@property (weak, nonatomic) IBOutlet FBSDKProfilePictureView *profilePicture;
in .m file declare that 在.m文件中声明
self.profilePicture.profileID = [ result objectForKey:@"id"];
UIImage *img=self.profilePicture;
giving error that 给出错误
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKProfilePictureView CGImage]: unrecognized selector sent to instance 0x7fdd5a5651e0'
*** First throw call stack:(
0 CoreFoundation 0x0000000106366a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000105ffabb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010636dd1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001062c59dc ___forwarding___ + 988
4 CoreFoundation 0x00000001062c5578 _CF_forwarding_prep_0 + 120
5 UIKit 0x00000001048c5732 UIImagePNGRepresentation + 33
6 SmartCookieProgram 0x0000000103bd0770 __47-[LoginViewController loginViewFetchedUserInfo]_block_invoke + 2880
7 SmartCookieProgram 0x0000000103c0b903 -[FBSDKGraphRequestMetadata invokeCompletionHandlerForConnection:withResults:error:] + 146
8 SmartCookieProgram 0x0000000103c11c6d __64-[FBSDKGraphRequestConnection processResultBody:error:metadata:]_block_invoke370 + 142
9 SmartCookieProgram 0x0000000103c11a02 -[FBSDKGraphRequestConnection processResultBody:error:metadata:] + 1046
10 SmartCookieProgram 0x0000000103c114d0 __64-[FBSDKGraphRequestConnection completeWithResults:networkError:]_block_invoke + 428
11 CoreFoundation 0x000000010629e782 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
12 CoreFoundation 0x000000010629dedc -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 300
13 SmartCookieProgram 0x0000000103c11287 -[FBSDKGraphRequestConnection completeWithResults:networkError:] + 670
14 SmartCookieProgram 0x0000000103c10574 -[FBSDKGraphRequestConnection completeFBSDKURLConnectionWithResponse:data:networkError:] + 669
15 SmartCookieProgram 0x0000000103c0eca2 __36-[FBSDKGraphRequestConnection start]_block_invoke_2 + 72
16 SmartCookieProgram 0x0000000103c0c034 -[FBSDKURLConnection invokeHandler:error:response:responseData:] + 85
17 SmartCookieProgram 0x0000000103c0bfa9 -[FBSDKURLConnection logAndInvokeHandler:response:responseData:] + 395
18 SmartCookieProgram 0x0000000103c0c2fa -[FBSDKURLConnection connectionDidFinishLoading:] + 135
19 CFNetwork 0x0000000108e3b98c __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 69
20 CFNetwork 0x0000000108e3b930 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 199
21 CFNetwork 0x0000000108e3ba97 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
22 CFNetwork 0x0000000108d0b937 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 107
23 CFNetwork 0x0000000108dd8a31 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 273
24 CFNetwork 0x0000000108cf6d16 _ZN19RunloopBlockContext13_invoke_blockEPKvPv + 72
25 CoreFoundation 0x000000010626eb44 CFArrayApplyFunction + 68
26 CFNetwork 0x0000000108cf6bd7 _ZN19RunloopBlockContext7performEv + 133
27 CFNetwork 0x0000000108cf6a16 _ZN17MultiplexerSource7performEv + 256
28 CFNetwork 0x0000000108cf682c _ZN17MultiplexerSource8_performEPv + 72
29 CoreFoundation 0x000000010629bc91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x0000000106291b5d __CFRunLoopDoSources0 + 269
31 CoreFoundation 0x0000000106291194 __CFRunLoopRun + 868
32 CoreFoundation 0x0000000106290bc6 CFRunLoopRunSpecific + 470
33 GraphicsServices 0x0000000107e02a58 GSEventRunModal + 161
34 UIKit 0x0000000104892580 UIApplicationMain + 1282
35 SmartCookieProgram 0x0000000103bce9c3 main + 115
36 libdyld.dylib 0x0000000107648145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
please provide solution for the error and also want to know how to get user Location using FBSDKGraphRequest
and FBSDKGraphRequestConnection
请提供错误的解决方案,并且还想知道如何使用
FBSDKGraphRequest
和FBSDKGraphRequestConnection
获取用户位置
FBSDKProfilePictureView
is kind of UIView class, not an Image. FBSDKProfilePictureView
是一种UIView类,而不是Image。
Add an UIImageVIew on your xib or storyboard and create an IBOutlet of the same. 在xib或情节提要板上添加UIImageVIew并创建相同的IBOutlet。
@property (weak, nonatomic) IBOutlet UIImageView *imageView; @属性(弱,非原子)IBOutlet UIImageView * imageView;
Use the following code: 使用以下代码:
self.profilePicture = [[FBSDKProfilePictureView alloc] initWithFrame:_imageView.frame];
[_profilePicture setProfileID: result[@"id"]];
[self.view addSubview:_profilePicture];
It will work!! 会的!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.