Author Topic: Social Framework (Twitter, Facebook) for iOS, iPhone, iPad  (Read 3820 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Hi,

find the attached 2 files. Place the .mm file in your xcode project. Drag it into the "classes" folder in XCode then.


Include the gbas file into your project. Then, first, see if the service is available. If so, do the posting. You can either post text, url or an image.

Tadaaa.

The rotation might not be correct. Pardon me.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
Nice work!  :booze:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline DaCarSoft

  • Community Developer
  • Mr. Polyvector
  • ******
  • Posts: 182
    • View Profile
Hi.

About rotation/orientation, I replied you (Gernot) here:

http://www.glbasic.com/forum/index.php?topic=7927.msg78589#msg78589
"Si quieres resultados distintos... no hagas siempre lo mismo" - Albert Einstein.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
What framework(s) do you need to add to get this working? ("social.framework"?)

Also, I'm getting this error...

Code: GLBasic [Select]
Undefined symbols for architecture armv7:
  "_gpiPhoneViewControllerWithRotation", referenced from:
      -[GLBasicThing intern_post] in social_framework_ios.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Social. I can't remember off my mind. But not the olt twitter/facebook ones.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
Couple of small problems with this routine...

Code: GLBasic [Select]
//! post
// \return TRUE/FALSE if social framework is available for this platform
FUNCTION SocialFramework_Post%: stype%, text$, url$, img_id_sprite% = -1
        LOCAL rv% = FALSE
        LOCAL img$ = PLATFORMINFO$("TEMP") + "/socialimg.png"
        IF img_id_sprite >=0
                SAVESPRITE img$, img_id_sprite%
        ENDIF

        ?IFDEF IPHONE
                rv% = iosSocialPostMessage(stype, text$, url$, img$);
        ?ELSE
                // we're just doing NETWEBEND :(
                NETWEBEND "http://www.glbasic.com/main.php?site=gack_connect&nonav=1"
                rv = 1
        ?ENDIF

        IF img_id_sprite >=0
                KILLFILE img$
        ENDIF

        RETURN rv%
ENDFUNCTION

Code: GLBasic [Select]
LOCAL img$ = PLATFORMINFO$("TEMP") + "/socialimg.png"

Tries to create an img$ with ..(temp folder)"//socialimg.png" with the latest GLB beta, which it fails at.

Also, if you use img_id_sprite% = -1 then this line again...

Code: GLBasic [Select]
LOCAL img$ = PLATFORMINFO$("TEMP") + "/socialimg.png"

Creates a path to a file that will not be created. SAVESPRITE  is never visited to create it.

And this line will then try to read it...

Code: GLBasic [Select]
rv% = iosSocialPostMessage(stype, text$, url$, img$);

This is the routine patched...

Code: GLBasic [Select]
//! post
// \return TRUE/FALSE if social framework is available for this platform
FUNCTION SocialFramework_Post%: stype%, text$, url$, img_id_sprite% = -1
        LOCAL rv% = FALSE
        LOCAL img$ // "" is OK as it's handled in the ObjC
        IF img_id_sprite >=0
                img$ = PLATFORMINFO$("TEMP") + "socialimg.png"
                SAVESPRITE img$, img_id_sprite%
        ENDIF

        ?IFDEF IPHONE
                rv% = iosSocialPostMessage(stype, text$, url$, img$);
        ?ELSE
                // we're just doing NETWEBEND :(
                NETWEBEND "http://www.glbasic.com/main.php?site=gack_connect&nonav=1"
                rv = 1
        ?ENDIF

        IF img_id_sprite >=0
                KILLFILE img$
        ENDIF

        RETURN rv%
ENDFUNCTION

Unfortunately though it does not solve my problems?  :noggin:
« Last Edit: 2013-Jul-25 by bigsofty »
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
@bigsofty: Did you use the V11 beta? It "should" be in there.
Also, clean and rebuild. Make sure you use the correct libGLBasic-egl.a library. Maybe the compile process did not overwrite the one in your project folder after the update. It's in compiler/platform/iPhone/XCode/GLBasic/Lib.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2542
    • View Profile
Thanks for the reply Gernot, I solved the problem by only supporting iOS 6+ IIRC in the XCode project settings. Not the best solution I know but I needed it out for a deadline.
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline tatakamucher

  • Mr. Polyvector
  • ***
  • Posts: 127
    • View Profile
how can i use it  :| ? some example pls  :D