Results 1 to 2 of 2

Thread: Twitter Links Broken

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Nov 2010
    Vote Rating

    Default Answered: Twitter Links Broken

    Hi there,

    I'm building an app based on the O'Reilly Conference app example shipped with Sencha Touch. The Tweet Store is loading properly, but the links to the tweets within are broken.

    The behaviour can be seen in the O'Reilly Conference App example. Load it, and go to the Twitter panel. Now click one of the tweets. It asks if you want to open it in Click yes, and you will (most likely) be taken to a "Sorry, that page doesn't exist" page.

    As far as I can tell, it's because the tweet id is getting rounded when it goes into the store. For example, a tweet id that comes in from the twitter feed as 103551456984051712 gets stored as 103551456984051710 (note the least significant digit).

    I'm baffled and don't know where to start. Has anyone else seen/solved this issue?

    Trevor Mills

  2. I still don't know why it appears that the ID gets rounded, but I've figured out a workaround. The Twitter API actually sends back both an `id` and an `id_str` parameter. They contain the same value. Sencha seems to mangle `id`, but thankfully `id_str` is left unchanged. The workaround then involves two simple things:

    1) Add `id_str` to the Tweet Model
    2) Update how the window.location string gets built when opening the tweet in a new window

    Working from the O'Reilly Conference App sample app, I had to modify two files:

    I modified examples/oreilly/src/Models.js, changing line 28 from:

    fields: ['id', 'text', 'to_user_id', 'from_user', 'created_at', 'profile_image_url']

    fields: ['id', 'id_str', 'text', 'to_user_id', 'from_user', 'created_at', 'profile_image_url']
    Then, I modified examples/oreilly/src/TweetList.js, changing line 71 from:

    window.location = '' + records[0].data.from_user + '/status/' + records[0]

    window.location = '' + records[0].data.from_user + '/status/' + records[0].data.id_str
    Hope someone else finds this helpful.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts