GLBasic forum

Main forum => GLBasic - en => Topic started by: kaotiklabs on 2012-Apr-11

Title: looking for IOS twitter/facebook sharing
Post by: kaotiklabs on 2012-Apr-11
Hi guys,

I´m looking for an easy way to wrap a twitter/facebook sharing library on an iPhone app.

I´m trying with this IOS third pary libraries:

ShareKit was my first target and nearly worked but the library seems not been updated anymore and is kinda buggy.
Socialize seems really good but must be compiled with flags -ObjC -all_load and is giving a lot of crashes and headaches.
My last try is using AddThis with no luck by the moment.

any of you had luck with another method?
Title: Re: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Mar-13
*bump*
Can you test if these methods are an OK solution for mobile devices?
http://www.glbasic.com/main.php?site=gack_connect

On Windows, the twitter one works.
Title: Re: looking for IOS twitter/facebook sharing
Post by: Marmor on 2013-Mar-13
beware , twitter changed his api to rest api 1.1 .
old api works until end march and maybe 1-6 month later in some cases.
grrr..
Title: Re: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Apr-11
I had a little time to play with GLBasic last night and I think I wrapped the twitter/facebook API for iOS properly.
Find the attached files. You have to use the .gbas file and calls. And then include the .mm file in your xcode project (where the main.m file already is).

Can someone test it? I had a horrible time with my certificates, again.

For non-iOS I added a silly wrapper, but I think we should netwebend with the proper URLs+text directly.
Please feel free to change all this.
Title: Re: looking for IOS twitter/facebook sharing
Post by: trucidare on 2013-Apr-11
Hi Phoo, nice work!
Native Social Support wrapped.
But do some Magic with memory - since llvm supports ARC you don't need all the retain and release garbage but the xcode project i made has no arc support.

Title: Re: looking for IOS twitter/facebook sharing
Post by: Jonás Perusquía on 2013-Apr-12
nice :D
Title: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Apr-13
Trucidare. What do you mean? I don't understand it. I packed the mm file into the xcode project, not with require.
Title: Re: looking for IOS twitter/facebook sharing
Post by: matchy on 2013-Apr-14
I have attempted to test but trying to work out the framework for iOS5 as this seems for iOS6.
Title: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Apr-14
Yes. I think every device that can have ios 5 will now have ios 6. why not?
Title: Re: looking for IOS twitter/facebook sharing
Post by: spacefractal on 2013-Apr-14
nope. You will force out iPad 1 users examle with lastest iOS was version 5. Anyway its should of course which iOS that is isntalled and then only uses functions if iOS6 is installed. So make sure to check iOS version first.
Title: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Apr-14
This check is in. Also, for ios 5 you could use the netwebend alternative.
Title: Re: looking for IOS twitter/facebook sharing
Post by: matchy on 2013-Apr-14
Social.Framework (Social/Social.h) seems to be available only for iOS6 but I am using xcode iOS5 which seems to have separate Facebook and Twitter frameworks. Although I added the framework anyhow but can't find the it in compile and note that I am only trying to test it.
Title: Re: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-Apr-27
Help. I get now:
Code (glbasic) Select

2013-04-27 14:20:46.577 iPhone[563:4a0b] bool _WebTryThreadLock(bool), 0x23176bb0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
1   0x38c7a3b7 WebThreadLock
2   0x34c8106d <redacted>
3   0x34c81047 <redacted>
4   0x34b62661 <redacted>
5   0x34ce9295 <redacted>
6   0x34cebee1 <redacted>
7   0x34ceba85 <redacted>
8   0x34ce88f5 <redacted>
9   0x34ce84cb <redacted>
10  0x34ce816f <redacted>
11  0x34ce9383 <redacted>
12  0x34ceaea5 <redacted>
13  0x34ce88f5 <redacted>
14  0x34ce816f <redacted>
15  0x34ce8a97 <redacted>
16  0x34ce88f5 <redacted>
17  0x34ce84cb <redacted>
18  0x34ce816f <redacted>
19  0x34ce6233 <redacted>
20  0x34ce5b9b <redacted>
21  0x34bde03d <redacted>
22  0x34b6846d <redacted>
23  0x34c34bf5 <redacted>
24  0x48a2f iosSocialPostMessage
25  0x235fa0 __GLBASIC__::SocialFramework_Post(int, __GLBASIC__::DGStr, __GLBASIC__::DGStr, int)
26  0x168248 __GLBASIC__::MoreOptions()
27  0x182b28 __GLBASIC__::MainMenu(__GLBASIC__::Tgame&)
28  0x1c9160 __GLBASIC__::Editor()
29  0x1151d8 __GLBASIC__::__MainGameSub_()
30  0x5d634 iPhoneMain
31  0xa0f70 iPhoneMainThread


I think I have to run it in another thread. But how was that again?

Title: Re: looking for IOS twitter/facebook sharing
Post by: bigsofty on 2013-May-01
It looks like you need to force it back onto the main thread?
See...

http://stackoverflow.com/questions/9679754/tried-to-obtain-the-web-lock-from-a-thread-other-than-the-main-thread-or-the-web
Title: Re: looking for IOS twitter/facebook sharing
Post by: DaCarSoft on 2013-May-02
Hi!!!

I solved that problem in my wrappers using "PerformSelectorOnMainThread".

You can found an example here:

http://www.glbasic.com/forum/index.php?topic=6708.msg54085#msg54085 (http://www.glbasic.com/forum/index.php?topic=6708.msg54085#msg54085)

Hope this helps
Title: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-May-02
Right. I forgot about it. You're awesome!
Title: Re: looking for IOS twitter/facebook sharing
Post by: Kitty Hello on 2013-May-02
and here is the solution:
http://www.glbasic.com/forum/index.php?topic=9178.0   :enc:
Title: Re: looking for IOS twitter/facebook sharing
Post by: DaCarSoft on 2013-May-03
Gernot, it's nothing!

I will reply here to  your comment about orientation in the other topic:
Quote"The rotation might not be correct. Pardon me."

I have not tested your code for Facebook/Twitter yet, but I suppose that you refers to the orientation problems that appears when a wrapper is called to create something on screen and is not the same than the orientation of the GLBasic's game.

Apple have changed (again) the way in which the orientation works under iOS, I'm testing it trying to found the easiest way to solve it without changes to the code that I sent you in the past to solve some of these kind of problems under iOS.

In addition I'm having a strange error with the last Beta 11 of GLBasic when I add my ".mm" files for wrappers into my project. It does not compile showing "arm7" errors...    :blink: ¿?

I have not tested it (until), but may be that you can call to my "iOSSetOrientation" wrapper to change the orientation by code, just before to the call to make appear your wrapper. Just like this:

http://www.glbasic.com/forum/index.php?topic=6706.msg67781#msg67781 (http://www.glbasic.com/forum/index.php?topic=6706.msg67781#msg67781)

Using my wrapper published here:

http://www.glbasic.com/forum/index.php?topic=6707.msg54084#msg54084 (http://www.glbasic.com/forum/index.php?topic=6707.msg54084#msg54084)


If someone have the enough time to test it I would like to know if this works.

UPDATE: I tested it finally and it works!!! You can stablish the orientation that you want using my "iOSSetOrientation" just before the call to show the social wrapper.