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
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 <-
hmm...
im kida stuck on this part :)
any example code somewhere or a simple tutorial for us non "C" People :)
Don't think anyone has tried to connect to Facebook, I'm afraid...
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?
untested - coded in forum editor
@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];
}
Now you need to exand that for use with non-Apple code :)
compile this code as static iphone lib
then input in glbasic game:
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
i dont understand?
what do you mean a static iphone lib?
sorry for the questions
im still trying to figure out this warpper thing
open xcode -> new project -> iphone (library) -> static lib -> insert code -> compile -> got libXXXX.a
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
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
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 :)