MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

Last post 07-25-2009 5:11 AM by finwe. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-15-2009 8:31 AM

    opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

      Hi,

    We are having difficulty in obtaining viewerId and ownerId in the profile surface for our apps. We are currently using opensocial 0.8 (although the difficulty also occurs in 0.7). The code below works in FireFox and IE when only one app using this method is present in the profile page.

    The difficulty occurs when we try and use this opensocial technique with more than one app in the profile page. At this point the behaviour of IE and FireFox diverge.

    (example results when using two apps)

    FireFox sends only one opensocial get request, and thus only one app renders output, the other never gets to run the handleOpenSocialResponse function, thus stalling. It appears that the first (to be run by firefox) app's javascript is the one that emits an opensocial get request, the result being only one random app working.

    IE 7 renders both apps (thus sending and receiving two separate opensocial requests) about 80% of the time, the remaining 20% of the time only one opensocial request is sent, and thus only one app renders.

    In both cases it appears to be req.send(handleOpenSocialResponse); that does not emit the correct number of calls.

     

    Please help, we have two apps that need to work in the profile page.

    A generalization of the code we're using in both apps follows. Are we doing something dumb – or have we run into something arcane?


    <div class="ourapp">

    <div id="report" class="report"></div>

    <script language="JavaScript">

    // <!--

    var req = opensocial.newDataRequest();

    function handleOpenSocialResponse(result) {

       var owner = result.get("owner");

       owner_data = owner.getData();

        var viewer = result.get("viewer");

        viewer_data = viewer.getData();

        var viewerId;

        if (!viewer_data) { viewerId = 'unknown' }

        else { viewerId = viewer_data.getId() }

        var report = document.getElementById('report');

        report.innerHTML = 'ownerId:' + owner_data.getId() + '<br/>viewerId:' + viewerId;

    }

    function getOpenSocialData() {

        req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),"owner");

        req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),"viewer");

        req.send(handleOpenSocialResponse);

    }

    getOpenSocialData();

    // -->

    </script>



    Note: this doesn't work at all in opera, altough i've seen several other forum threads that touch on this issue. eg.

    http://developer.myspace.com/Community/forums/p/6479/33821.aspx#33821

    http://developer.myspace.com/Community/forums/p/6778/33824.aspx#33824



    An easy way to view this behaviour is to install our two apps and allow both in your profile and watch. If either app is installed it should render ok, if both are the the oddness starts.

    App A: http://profile.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=402805525

    App B: http://profile.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=402804969


  • 01-15-2009 4:05 PM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     Let me check into it thanks for the info

  • 01-15-2009 5:02 PM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

    Hi,

     

    Your call looks right. You should be getting the data back. I'm researching this issue. I will have some answers for you tomorrow.

     

    Jorge

  • 01-16-2009 3:30 PM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     Hi Nei,

     There is a issue in your app.

    opensocial.DataRequest.PersonId.OWNER not longer exist you have to use instead

    opensocial.IdSpec.PersonId.OWNER  

    same with viewer instead of

    opensocial.DataRequest.PersonId.VIEWER you should be using

    opensocial.IdSpec.PersonId.VIEWER

    There is an issue with viewer in the profile and home. We checked in a fix that should be in place by friday next week.

    Jorge
  • 01-19-2009 2:52 AM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     thankyou very much, I'll make those changes and monitor the situation

  • 01-26-2009 7:01 AM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     Hi, 

    I'm now getting  a firebug error in firefox of 'opensocial.IdSpec is undefined' when trying to run

    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),"owner");

    IE 7 generates an "'opensocial.IdSpec.PersonId' is null or not and object" error on the profile and app canvas page too. 

    any Ideas? this is currently stopping our app rendering on both profile and canvas pages now....

     

     

     

  • 01-27-2009 3:45 AM In reply to

    • Faizan
    • Not Ranked
    • Joined on 12-18-2008
    • Posts 7

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     I'm having same problem with my app on profile surface.

    I get data.get(opensocial.IdSpec.PersonId.OWNER) is undefined error in firebug.

    any solution to this?

  • 01-27-2009 3:58 AM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

    Hi I started a new post about this specific issue here

     http://developer.myspace.com/Community/forums/t/6999.aspx

     i'm living in hope this can be resolved quickly.

  • 02-06-2009 10:20 AM In reply to

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

     opensocial.IdSpec.PersonId.OWNER is use in 0.8 with the introduction of idSpec if you are using 0.7 you should be using opensocial.DataRequest.PersonI.OWNER. That may be the problem

  • 07-25-2009 5:11 AM In reply to

    • finwe
    • Top 500 Contributor
    • Joined on 06-08-2008
    • Posts 13

    Re: opensocial.newDataRequest().send(return_fuction) inconsistent behaviour

    I have the same issue.

    I use opensocial v0.8. But i also tried with v0.7.. And i tried both  "opensocial.IdSpec.PersonId.OWNER" and "opensocial.DataRequest.PersonId.OWNER", nothing changed.

    Response is null under IE-7. It works fine with IE-6 or FireFox..

    var params = {};
    params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
    [opensocial.Person.Field.PROFILE_URL];
    var req = opensocial.newDataRequest();
    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER,
    params), "req");
    req.send(response); 

     

    Any solution??

Page 1 of 1 (10 items)