iOS Question Facebook Library

Rory Mapstone

Member
Licensed User
Longtime User
Hi,

I have looked on the forums, but could not find a library for simple facebook login.
What is the best way to implement this?

I have never written a library in xCode, but i'm currently looking into this.

Does anybody have anything that they can share?
 

narek adonts

Well-Known Member
Licensed User
Longtime User
But why you are not allowing us to create a class intead of a library with inline OBJC. You are limiting the PC users.
For exemple I created almost a full class for UIGestureRecognizer with inline OBJC. I think one of the most benefit of B4i is to be able to develop iOS apps on windows. I dont have a Mac but I need to implement Facebook,... to my app.
I dont think it is difficult to install the SDK on the hosted builder and also others SDK also.
 
Upvote 0

miker2069

Active Member
Licensed User
Longtime User
Thank You Erel!

I actually bit the bullet a dove into the Facebook SDK for iOS. Which means I had to dust off my old big nerd ranch for iOS programming (I got fairly far then got busy so had to re-learn everything again, fortunately it came back rather quick). Facebook SDK is a bit intimidating at first, however 3 days later, I have a test objective c app that I can successfully log into and out of Facebook! Glad i did it as now I have a somewhat decent understanding of the basics (and not so intimidated anymore...).

Now on to learning about B4i libraries. Forgive as I've never written a library for the B4x platform at all.

My initial question is, the Facebook SDK requires incorporating the Facebook delegate in the iOS apps delegate didFinishLaunchingWithOptions method. For example:

[FBSDKApplicationDelegatesharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];


How can I hook this into a B4i app via a library?

There's also a few other methods that need to be implemented that appear that need to be in the appdelegate.m of the application. So similar to the above question, how would this work?


Next, at some point I would have to pass in a pointer/reference to the window where the Facebook login button will get "automagically" placed. Typically this is done in the view controller .m file, in the viewDidLoad method:

FBSDKLoginButton *loginButton = [[FBSDKLoginButtonalloc] init];
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
NSLog(@"Hi Mike");
loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends"];

[loginButton setDelegate:self];


Where self is obviously the instance of the view controller. How could achieve this?

I think once I get my head wrapped around these two questions, I will be on my way to making a basic Facebook login library.

Thank You very much!

Mike
 
Upvote 0

miker2069

Active Member
Licensed User
Longtime User
Actually after thinking about it for a moment (really guessing), I may not need to hook into the init of the b4i app delegate per se, but rather get a reference to whatever the UIApplication instance is of my b4i app. I can then pass that as the application parameter:

[FBSDKApplicationDelegatesharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];


I guess I could implement the delegate in the library I would create and as long as I have the app I could init it there? Again please forgive me, totally new to all this.

Also saw in another thread that a page object is a wrapper for UIViewController so I *think* for the second part of my question I could get away with using that for the window/controller of whatever is going to be my login page in my b4i app.

Does that sound plausible?
 
Last edited:
Upvote 0

miker2069

Active Member
Licensed User
Longtime User
The B4i developer will call a method that will execute this code from Application_Start sub.

I recommend to start with a simpler library.
Thank you Erel.

I assume I can get a ref to the application object using:

[UIApplication sharedApplication];

I won't need to pass anything in from the calling b4i routine.
 
Upvote 0
Top