To View ProfilePicture in Xcode of facebook user

2019-04-22 04:26发布

When i am using

self.profilePic.profileID = user.id;

i end up with this error

-[UIView setProfileID:]: unrecognized selector sent to instance 0x69626f0
2012-09-11 09:49:50.535 TweetApp[992:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setProfileID:]: unrecognized selector sent to instance 0x69626f0'

can anyone help on this topic??

5条回答
淡お忘
2楼-- · 2019-04-22 04:53

Let's do it step-by-step.

self.profilePic refers to your property of UIView type.

Then you are trying to set this property's property profileID, but UIView class doesn't have such and you get the exception.

It will be easy for you to understand in the future from the error message, pay attention to the reason:

'-[UIView setProfileID:]: unrecognized selector sent to instance 0x69626f0'

It tells you the method -setProfileID: is called for UIView* object and with the code you posted it is clear why it happens.

I suppose you have profileID property in the view controller, then you'll want to use

self.profileID = user.id;

Or if self.profilePic should support profileID property then you initialized it incorrectly, find the initialization place to see what happens.

查看更多
smile是对你的礼貌
3楼-- · 2019-04-22 04:56

You can fix this issue simply. Just put this line code [FBProfilePictureView class]; at the first line of method application:didFinishLaunchingWithOptions:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [FBProfilePictureView class];
    //...
    return YES;
}
查看更多
唯我独甜
4楼-- · 2019-04-22 05:02

I had the same problem, itsaboutcode is right. Call [FBProfilePictureView class]; in your AppDelegate and the problem will be fix

++

查看更多
一夜七次
5楼-- · 2019-04-22 05:05

I faced the same problem make sure your profile pic is an instance of FBProfilePictureView go to your layout and change the class of your view to be FBProfilePictureView notice your fb profile pic is a UIView not an ImageView that means u need to add view and change its class to FBProfilePictureView not an ImageView

also add this line at the first of your app delegate [FBProfilePictureView class]; enter image description here

enter image description here

查看更多
放荡不羁爱自由
6楼-- · 2019-04-22 05:06

I believe you are talking about Facebook Scrumptious sample project. If that is the case, you have to set the Class of UIView control to FBProfilePictureView

enter image description here

查看更多
登录 后发表回答