GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2010-Aug-31

Title: starting on facebook connect
Post by: djtoon on 2010-Aug-31
i found this:
http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app

how do i star a wrapper whats the first step
Title: Re: starting on facebook connect
Post by: trucidare on 2010-Aug-31
Create a .mm file with extern "C" function that do something with the facebook sdk then import function in glbasic with IMPORT "C" and use in your game. compile run and think -> whoa thas porn <-
Title: Re: starting on facebook connect
Post by: djtoon on 2010-Oct-27
hmm...
im kida stuck on this part :)
any example code somewhere or a simple tutorial for us non "C" People :)
Title: Re: starting on facebook connect
Post by: MrTAToad on 2010-Oct-27
Don't think anyone has tried to connect to Facebook, I'm afraid...
Title: Re: starting on facebook connect
Post by: matchy on 2010-Oct-27
Quote from: djtoon on 2010-Oct-27
hmm...
im kida stuck on this part :)
any example code somewhere or a simple tutorial for us non "C" People :)

Does "C" stand for complacent?
Title: Re: starting on facebook connect
Post by: trucidare on 2010-Oct-28
untested  -  coded in forum editor

Code (glbasic) Select

@interface GLB_FB_Wrapper : NSObject {
       static NSString* _secret;
       static NSString* _key;
       FBSession* _session;
       FBLoginDialog* _loginDialog;
}

- (void)_glb_fb_init:(NSString*)secret :(NSString*)key;
- (void)_glb_fb_login;
@end

@implementation GLB_FB_Wrapper
- (void)_glb_fb_init:(NSString*)secret :(NSString*)key {
        self._key = key;
        self._secret = secret;
         _session = [[FBSession sessionForApplication:key
                                      secret:secret delegate:self] retain];
}

- (void)_glb_fb_login {
        _loginDialog = [[FBLoginDialog alloc] init];
        [_loginDialog show];
}
@end

GLB_FB_Wrapper* FB_Connect;

extern "C" GLB_FB_Init(const char* secret, const char* key) {
      FB_Connect = [[GLB_FB_Wrapper alloc]init];
      [FB_Connect _glb_fb_init:[NSString stringWithUTF8String:secret] :[NSString stringWithUTF8String:key]];
}

extern "C" _glb_fb_login() {
      [FB_Connect _glb_fb_login];
}
Title: Re: starting on facebook connect
Post by: MrTAToad on 2010-Oct-28
Now you need to exand that for use with non-Apple code :)
Title: Re: starting on facebook connect
Post by: trucidare on 2010-Oct-28
compile this code as static iphone lib

then input in glbasic game:

Code (glbasic) Select
IMPORT "C" GLB_FB_Init(const char* secret, const char* key)
IMPORT "C" GLB_FB_Login()


add the lib and the facebook sdk to your gameproject compile and all fine
Title: Re: starting on facebook connect
Post by: djtoon on 2010-Oct-28
i dont understand?

what do you mean a static iphone lib?
sorry for the questions
im still trying to figure out this warpper thing

Title: Re: starting on facebook connect
Post by: trucidare on 2010-Oct-28
open xcode -> new project -> iphone (library) -> static lib -> insert code -> compile -> got libXXXX.a

Title: Re: starting on facebook connect
Post by: djtoon on 2010-Oct-28
xcode is realy weird :(

can getit to work :)
im trying too ... maybe ill find a good tutorial somewhere on the net

i know this is a big thing but can you create some sort of tutorial?
could be usefull for alot of people

thank you
Title: Re: starting on facebook connect
Post by: trucidare on 2010-Oct-28
its realy simple - if i have some time i will write a german tutorial and someone translate it to english.

there are only 3 steps:

1.) Create your lib in XCode with extern "C" flags - compile
2.) Import functions int GLBasic with IMPORT and compile for xcode
3.) open compiled xcode project and add the lib from step 1. compile and have fun
Title: Re: starting on facebook connect
Post by: djtoon on 2010-Oct-28
this sould be a built in feature in glbasic :)
it will make it stand out more in the iphone app makeing class :)

i know
i use alot of them :)