2

Edit #3: I somehow missed a second console message the 10 times I ran this, keeping me puzzled about this. It's a known problem that's been solved. I need "-all_load -ObjC" set as a linker flag, and I don't know why it wasn't already like that. See "Unknown class <MyClass> in Interface Builder file" error at runtime

I'm trying to use an FBLoginView (part of the Facebook SDK framework), a subclass of UIView, in my storyboard and set a property on it in viewDidLoad in the view controller for its superview. This is what I have: IB and code

The UIView (grey box) shown has its class set to FBLoginView, as you can see. It's linked to the property loginView in my view controller .m on the right.

In viewDidLoad, it does _loginView.readPermissions = @[@"user_friends"], which causes the program to crash. Edit #2: The log says:

App became active.
Unknown class FBLoginView in Interface Builder file.
-[UIView setReadPermissions:]: unrecognized selector sent to instance 0x10c120b90

I set a breakpoint, and loginView is a UIView, not an FBLoginView. This doesn't make sense; I already changed it to FBLoginView in Interface Builder. How do I fix this?

Edit: Here is the connections inspector for the view controller in IB: enter image description here

Community
  • 1
  • 1
sudo
  • 5,604
  • 5
  • 40
  • 78
  • sounds strange, do you have an IBOutlet to your FBLoginView? – Injectios Aug 26 '14 at 22:52
  • You've shown that you have an `FBLoginView`. Now select the view controller in the storyboard, press Command-Option-6 to show the Connections inspector, and post a screen shot of that inspector. Also, are there any other messages in the debug console? – rob mayoff Aug 27 '14 at 03:23
  • @Injectios Yes, it's in the .m to the right. Sorry, the uploader shrunk my screenshot and made it harder to see. – sudo Aug 27 '14 at 04:25
  • @robmayoff I've edited my question to include the screenshot. I don't know why it's saying that it's connected to Login View… I didn't name anything in my project that. And yes, there IS another message in the console that I somehow didn't see, or it wasn't there before. "Unknown class FBLoginView in Interface Builder file." – sudo Aug 27 '14 at 04:36
  • possible duplicate of ["Unknown class in Interface Builder file" error at runtime](http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime) – sudo Aug 27 '14 at 04:44

2 Answers2

0

Some things to try:

  • Duplicate your FBLoginView class with a different name and try that.
  • Double check the spelling of your FBLoginView class name - check the file names for your .m and .h, and then check the interface/implemenation in the actual files to make sure it's capitalized correctly.
Adama
  • 1,101
  • 8
  • 26
  • It's definitely the correct spelling, and it even worked when I did this a similar way in another project (except without a storyboard). FBLoginView.h is part of FacebookSDK.framework. – sudo Aug 27 '14 at 04:30
0

Ensure FBLoginView.m is declared as your current build target member (e.g. compile sources). To do that, select FBLoginView.m in Project Navigator, see "Target Membership" section in the File Inspector as attached screenshot(deleted).

Edit:

You should read the documentation :)
See the bottom of "Adding the login UI control" section.

You must add [FBLoginView class] in - application:didFinishLaunchingWithOptions: AppDelegate method OR add the -ObjC flag to your linker options.

rintaro
  • 51,423
  • 14
  • 131
  • 139
  • Thanks. I don't have an FBLoginView.m anywhere since I just imported it from FacebookSDK.framework, which contains headers and the compiled library, but I checked, and the framework does have the correct target membership. – sudo Aug 27 '14 at 04:28