Invite Facebook friends to a rails app not working on mobile

247 views
Skip to first unread message

Ephraim Feig

unread,
Nov 18, 2013, 1:32:40 PM11/18/13
to sdr...@googlegroups.com
am pretty much following the method of http://www.youtube.com/watch?v=OSRRYeRSES4 to invite Facebook friends to my rails app. It works perfectly on my PC and it works on mobile when the app is run inside Facebook. But when I run the app natively (iPhone or Android), it opens the Facebook window but the friends list does not show up. It was working fine on iPhone until a few days ago, and suddenly it stopped working. The code is below. Any help will be greatly appreciated.

<div id="friends">
<p>  <%= link_to "Invite your Facebook friends", "#", :id => "invite_fb_friends" %> </p>
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>

    <% if !Rails.env.development? %>
        <script>
            $(function() {
                $("a#invite_fb_friends").click(function() {
                    FB.init ({
                        appId: '222840481199747',
                        cookie:true,
                        statue: true,
                        oauth: true

                    });
                    FB.ui({method: 'apprequests', message:'Hey! We need beta testers for this new app. No spam, ' +
                            'a bit of thinking before posting, and fun with friends.'  });
                });
            });
        </script>
    <% else %>
        <script>
            $(function() {
                $("a#invite_fb_friends").click(function() {
                    FB.init ({
                        appId: '545802082165826',
                        cookie:false,
                        statue: true,
                        oauth: true

                    });
                    FB.ui({method: 'apprequests', message:'Hey! We need beta testers for this new app. No spam, ' +
                            'a bit of thinking before posting, and fun with friends.'  });
                });
            });
        </script>
    <% end %>
</div>

Dave Rogers

unread,
Nov 18, 2013, 1:55:57 PM11/18/13
to sdr...@googlegroups.com
Ephraim,

Not sure if this is the reason but you have a typo in FB.init . The 'statue' option should be 'status'.

- Dave

--
--
SD Ruby mailing list
sdr...@googlegroups.com
http://groups.google.com/group/sdruby
---
You received this message because you are subscribed to the Google Groups "SD Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sdruby+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ephraim Feig

unread,
Nov 18, 2013, 2:27:48 PM11/18/13
to sdr...@googlegroups.com, sdr...@googlegroups.com
Dave,

Thank you. Yes, I must have made that typo while trying various options. But fixing the typo it did not fix the problem. Interesting that it worked with this typo in the other situations. Must be a clue somewhere there. 

Thanks again,
Ephraim


Sent from my iPhone
You received this message because you are subscribed to a topic in the Google Groups "SD Ruby" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sdruby/0-zbki5cSj8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sdruby+un...@googlegroups.com.
Message has been deleted

Ephraim Feig

unread,
Nov 20, 2013, 3:26:29 PM11/20/13
to sdr...@googlegroups.com
After more looking around, I deleted my latest comment and am adding this.

I was able to get Invite Facebook friends on IOS simulator by adding gem jquery-turbolinks, but strange things were happening. When I refreshed certain pages on IOS simulator using the refresh icon on the toolbar, some pages came back blank.  Everything works perfectly on regular PC.

Next, I removed all turbolinks from the project. That is, I removed the both turbolinks gem and jquery-turbolinks. I restarted the server, and sure enough, I can do Invite Facebook friends on IOS simulator. But still, some pages come back blank on after refresh. Once the page is blank, it stays blank even if I try to access it via a direct link in my application (not the refresh icon on the toolbar). It stays blank until I terminate IOS simulator and restart it again.

In the logs, when these failures occur, I complete all the rendering but I never get to  Started GET "/assets/application.css?body=1". It seems that I never get to the assets that will display all the stuff that is being rendered.  Again, this is only happening in mobile.

I think I need a vacation!
Reply all
Reply to author
Forward
0 new messages