Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / [TUTORIAL] How to setup an App for AGK + Facebook

Author
Message
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 10th Jan 2013 15:01 Edited at: 10th Jan 2013 15:17
There are some step you must do to get it work...

Create FB App
Create a new APP on the facebook developer page.
I will show only this image from FB tutorial, cause the process is personal and private but not hard.


After you created it, remember to insert the iOS App ID


Setup Library Framework
This is token directly from my other post on the lib to use.


Import or Include
Now go in the template.h and add:
#import <FacebookSDK/FacebookSDK.h>

Setting up Info.plist




As you see here, you must add those new rows to get it work, the first is the FacebookAppID, and is obvious. The second is a URL redirect for returning in your app when you logged in.
So:
- Appplication does not run in background -> NO
- Get your ID from FB App just created
- Add the array of URLs

XCode
Now you are about to complete the process.

Where xxxxxxxxxxx is the FB App ID you added also in the info.plist

If all is ok, you will be prompted via web for login, after this, your iOS app will return to work.

Considerations
I think is better to do it in silent mode just like the facebook app do, as you now can login directly from the settings on your device.
If there will be new updates or i discover something new, i will post the results below.
Now i will check post on wall, friends and the rest!!!
Good luck to me!


Long life to Steve!
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 10th Jan 2013 16:12
Anyway there is something don't go, i wanna see if we need a delegate to keep in memory the login.
I'm very stuck at this point.
Thinkin to develop it on my own.

Long life to Steve!
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 10th Jan 2013 17:29
Finally i got it working using Obj C.
I will update this post with the Obj C way to do it.

Long life to Steve!
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th Jan 2013 10:30 Edited at: 11th Jan 2013 10:42
Ok i got the 2nd way working very good, and is very easy.
I done a Obj C way to get it working.



Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Jan 2013 16:20
Excellent.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 16th Jan 2013 18:00
The one don t work is the AppGameKit one.
If you need how you can do to add facebook in 50 lines of code in obj c don t hesitate to ask.

Long life to Steve!
bjadams
AGK Backer
14
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 16th Jan 2013 22:38
I think it works, that's why they put Facebook support.

The problem is that we don't get the proper templates, only the devs have 100% working templates. We are left to deal with luck and frustration trying to fix templates, always finding some kind of errors. Many of the posts about problems are because of the lack of templates
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 18th Jan 2013 01:08
Yes, i always look at the interpreter_ios template to understand what they do.
But this is not good.
I'm using again the 1076 with my personal facebook integration.

Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Mar 2013 17:45
xGEKKOx, can you post the Objective C code as you said you would?

I'm curious to try this process and cannot use v1088 at this time.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th Mar 2013 01:03
Of course give me 5 min and i post it.
Remember it works with my template (the transposition of obj c in the c++)

Long life to Steve!
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th Mar 2013 01:24
This is the smallest code to have Facebook with iOS and AppGameKit using only obj C

Adding Frameworks
Ok as we said before you need those LIB to get all working:
- AdSupport (make it optional in build phase or will crash on old ios)
- Social (make it optional in build phase or will crash on old ios)
- Accounts (make it optional in build phase or will crash on old ios)
- Facebook Framework

Build Settings
Use the finder on the right and search for : Other Linker Flags
And add this one : -lsqlite3.0

Application Info PList
Add a row and write down this: FacebookAppID
and in the right side the ID of your application created on Facebook panel.

Now we can go to the code....

UntitledViewController.h
First of all, import the Framework (where you need, i usually import them in the template.h)
#import <FacebookSDK/FacebookSDK.h>

and after that add the delegate to your interface declaration
<FBLoginViewDelegate>

Now some code in the .h


UntitledViewController.m
The permissions...


Now the real code...
NOME_APPLICAZIONE = APP_NAME (declared in the h)


If you have question don't hesitate to ask.
Remember the way to call obj c functions from c++ i declared in my template.
[SC FBLogin];



Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Mar 2013 03:41
Cool. Thank you.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
CodeMonkey
9
Years of Service
User Offline
Joined: 6th Mar 2013
Location: Ireland
Posted: 17th Mar 2013 01:53
Cheers for the info xGEKKOx, this'll definitely be useful for some of my future apps. Is this possible with Tier 1 though? I'd like to program my first iOS game in Tier 1 preferably, but if it's not possible to do this I may just go with T2.
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 21st Apr 2013 01:13
Thanks for the help on this xGEKKOx!
I'm going through the process right now with my Android app and I'm wondering:
FB says they want to validate how my app uses FB...
I'm not going to put non-working FB commands in a live app
Did you put non-working FB commands in your app and make it live in the app store for them to validate or am I just being over-concerned?

Check out dFenz on Google Play, Windows, or Mac:
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd Apr 2013 17:04
What you mean for non-working commands?

Long life to Steve!
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Apr 2013 19:43
I mean that if I have a FB Share button without being approved it won't function correctly (i.e. the user won't be able to post to their wall).
It works in developer mode, but I believe only I can see that.

Also I'm being rejected for not showing a facebook login button, but I don't require facebook login. If I say that fb login isn't required on the app page then FB won't let me submit.

More about my lovely issues here.
http://forum.thegamecreators.com/?m=forum_view&t=205045&b=41

I'd really appreciate any help you (or anyone else who's actually got this working in a published app) can give!

Check out dFenz on Google Play, Windows, or Mac:
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd Apr 2013 21:16 Edited at: 22nd Apr 2013 21:18
Ah ok....
If you look in the post before, i written the code to post on the wall and to do login.
The method i posted is good for this (and is accepted by Apple)
- If the user is not logged in it ask the login in OLD (the safari page) or NEW (facebook login in the settings) way.
- If the user is logged, it say that is already logged
- Post on the wall of the user the score (if not logged, do the login automatically)

Of course you can change the post function for your needle.
But you need to add a button.

Remember that if you don't do a perfect Facebook App creation it will not work.
So you need to choose the Native App, and all the options you need.
I tried so many times to understand how to get it work, that now for me is very simple.

The AppGameKit Facebook commands don't work on 108 & 107 so don't lose time to use the internal commands. You need to do it in OBJ C!!!

If you need more help, don't hesitate to ask.


Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Apr 2013 21:18
xGEKKOx, do you have an Android version for these functions?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Apr 2013 21:24
Thanks, GEKKO, I guess that's my only option. If I want to simply post to the user's wall then I will have to show a button in the app even though it won't fully work until FB approves the app.

The code works perfectly for me in my unpublished app, just Facebook only shows the post to me in a developer view.

I wish they still fully supported the URL method of writing to the user's wall. Now you can only post a link (and the link to the Google Play shows bug swatter app icon bleh).

Thanks!!

Yes it is only android, so the updates are pretty fast. I just don't like pushing out an update that has a FB button that doesn't work yet

Check out dFenz on Google Play, Windows, or Mac:
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd Apr 2013 21:25 Edited at: 22nd Apr 2013 21:25
No Lady sorry, for the moment my team is just starting on Android, so personally i ignore it (i mean i'm leak on android as i think Apple is better in earning)....
The problem, i think for you, is that you are using the Basic, so you need to use the internal AppGameKit functions.
This is why i ask to the TGC team to leave to the coder which one LIB to include, doing them separately.
- AGK
- AGKFb
- AGKTwitter
- AppGameKit bla bla bla

So we can use what we want without those problems.
I hope you use c++ native on windows to code with android, or much things will be very hard to do if TGC doesn't fix those commands.

Anyway, Facebook wall posts help to sell more, i confirm!

Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Apr 2013 21:41
I am strictly Tier 2 at this point and been for quite a while. At least for my own stuff.

I've been able to test the recent facebook commands (v10811) and been able to successfully post something using the AppGameKit functions in both Android and iOS. My only complaint is that to post, it pops up a message box for the player to enter text. You can 'hard code' your own comment that appears in a comment bubble under the message posted by the user.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Apr 2013 21:59
Yeah, the commands work for Android in T1 too, so I'm hoping no T2 involvement necessary (I'm being stubborn and don't want to dust off my weak C skills).

@Ancient Lady - from what I read FB will not be allowing any automated posts without user confirmation, so I think the message box is here to stay (if that indeed is what you're referring to).

On another note, the popup is a bit ugly since ti fills the entire screen, though I spied some code in the one of the facebool layout xml files. Now I can't find it... but the constant used was fill_parent. Which made me assume that it was the correct on to fiddle with, but now I'm seeing lots of references to that.
Would be nice to not have it fill the entire screen

Check out dFenz on Google Play, Windows, or Mac:
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 23rd Apr 2013 14:37 Edited at: 23rd Apr 2013 14:49
Lady try to use facebook and notifications in the same time, you will have some crash.
Because the facebook notification delegate in the core.m is the same delegate of the loacl notifications.
The AppGameKit local notifications don't work for me and i don't know why. Well sometimes work, sometimes not.
With obj c works every time.
The same for Facebook, i get always strange errors, but i don't with obj c.

Another leak, is the command help.
Notification help is really poor.
Facebook help is the same.

I hope in the final 108 we will have better help file.
If TGC need an hand for this, we can exchange our Skype contact and add to AppGameKit help the missing one whenever we need. Updating it step by step without doing the job at 1 time.

Edit : My automated posts have been accepted until now.
I'm using it in 4/5 games.

Long life to Steve!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Apr 2013 16:45
I don't even know what the notifications are for. Something of a failure in the documentation.

I don't anticipate using them unless someone can explain them.

If I can figure out how to do a similar automated post in Android, I'll use yours and that. (And share how to do the Android one.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 23rd Apr 2013 21:20
Ok so i will add a new thread on the use of Notification center and some simple code.


Long life to Steve!
xGEKKOx
AGK Master
13
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 27th Apr 2013 18:52
Ok i learned how to send invite to friends with Obj C.
Is not that simple, but works great.

Anyway the Facebook SDK is always updating, now 3.5 so i think is better to use an extern Facebook LIB.

Long life to Steve!

Login to post a reply

Server time is: 2022-09-25 21:41:21
Your offset time is: 2022-09-25 21:41:21