Re: Twitter...

16 views
Skip to first unread message

Walter Tyree

unread,
Nov 2, 2012, 9:28:18 AM11/2/12
to tap...@googlegroups.com
The reason you are getting the image on the left is because any iPhone application uses a custom "User Agent String" when it is first using a UIWebView. Because Twitter doesn't recognize the "User Agent String" it is giving you a default stylesheet. When you reload the page, the iPhone is passing the "mobile safari" "User Agent String" so you are getting the mobile safari stylesheet.

The Mobile Safari User Agent string looks like this

Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3

You can try to change your User Agent String by using a Custom App Delegate in TapLynx and then setting the default using some code that looks like this in the delegate's ApplicationDidFinishLaunching method:
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];

So, THREE BIG WARNINGS:
- I haven't tested the code above
- There are open radars about this issue (reported bugs at Apple) so they might change how this works at any time
- If you are using the app's User Agent String to secure your feeds (per the TapLynx Support Wiki) then this will break that security

Walter Tyree
On Nov 2, 2012, at 5:09 AM, Tomtom <tho...@vvitonline.com> wrote:

> So when I load a mobile address in custom web view it loads strange but if I hit refresh then it loads correctly. Im using https://mobile.twitter.com/username How do I get it to laod correctly the first time?
>
> --
> --
>
>
> <Screen Shot 2012-11-02 at 5.07.16 AM.png><Screen Shot 2012-11-02 at 5.07.26 AM.png>

Reply all
Reply to author
Forward
0 new messages