UIWebView Unsupported URL - iphone

I'm using a UIWebView that's using an offline HTML file to manage it's workflow.
But, every time I tap on one of the items in the UIWebView the workflow is correct but I get a console message telling me that the URL is invalid.
The message is as follows:
{
NSErrorFailingURLKey = "applewebdata://BA77B31A-D9ED-4883-84BB-4270BCBEECA5?selected#node-2866424";
NSErrorFailingURLStringKey = "applewebdata://BA77B31A-D9ED-4883-84BB-4270BCBEECA5?selected#node-2866424";
NSLocalizedDescription = "unsupported URL";
NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1002 \"unsupported URL\" UserInfo=0x592ece0 {NSErrorFailingURLKey=applewebdata://BA77B31A-D9ED-4883-84BB-4270BCBEECA5?selected#node-2866424, NSErrorFailingURLStringKey=applewebdata://BA77B31A-D9ED-4883-84BB-4270BCBEECA5?selected#node-2866424, NSLocalizedDescription=unsupported URL}";
}
The error is quite clear, but I'm not completely sure where the error comes from, seeing that my URL is correct via the URI standard, as far as I know.
"applewebdata://BA77B31A-D9ED-4883-84BB-4270BCBEECA5?selected#node-2866424"
I don't know if there are differences between a normal HTTP URL and an AppleWebData URL, but this is correct according to the URI scheme.
e.g.:
scheme name:file name:query:fragment
Am I missing something here? I'd like to have my UIWebView do it's work without complaining about an incorrect URL, because the workflow is good. It does what I intended, but just not without being quiet.
Thanks in advance!
Bryan

Assuming you are loading this with loadHTMLString:, try setting the page's baseUrl as mentioned in this question: shouldStartLoadWithRequest appending link with applewebdata

Related

Facebook 500 Internal Server Error -> /dialog/feed

https://www.facebook.com/dialog/feed?app_id=128738460473752&link=http://videos.sapo.pt/fiLm1Zo3kiTzFUIoWYtU&feature=share&display=popup&redirect_uri=http://videos.sapo.pt/fiLm1Zo3kiTzFUIoWYtU?post_id
This url is giving me a internal server error (http://videos.sapo.pt/fiLm1Zo3kiTzFUIoWYtU).
The sample link provided at
https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.2#redirect
works for me:
https://www.facebook.com/dialog/feed?app_id=145634995501895&display=popup&caption=An%20example%20caption&link=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F%20&redirect_uri=https://developers.facebook.com/tools/explorer
but
https://www.facebook.com/dialog/feed?app_id=128738460473752&display=popup&caption=An%20example%20caption&link=http%3A%2F%2Fvideos.sapo.pt%2FfiLm1Zo3kiTzFUIoWYtU&redirect_uri=http://videos.sapo.pt/fiLm1Zo3kiTzFUIoWYtU
doesn't. Please check that
You app with the id 128738460473752 has configured http://videos.sapo.pt as a valid URL
URL Encode the link parameter
URL encoding the link parameter doesn't work anymore.
Facebook is now returning an error inside the popup if you do it.
You don't have to URL encode your link parameter, but you can just leave it as text.

Redirection handling in ROKU

I am trying to call an API in ROKU player using bright script. But I a getting "response code -3". But when I am hitting that service on Web Browser it gives the xml in response. Actually there is a redirection in the API which I am using. As I know the redirection is not handled by the ROKU OS level. So How will I come out this situation.
Please help me and provide me any solution for that how can I handle the redirection in ROKU?
Thanks in advance.
The documentation at http://sdkdocs.roku.com/display/sdkdoc/roUrlEvent gives CURLE_URL_MALFORMAT as name for the -3 code you got from GetResponseCode() on the roUrlEvent. Try checking the string you get from GetFailureReason() on that same roUrlEvent, which should give a more detailed description of the problem.
Please check if you are missing any header in http request.
Check for accept header also.
Check this link how to make Get and Post request in Roku.
request = CreateObject("roUrlTransfer")
request.SetUrl("http://blog.roku.com/developer")
html = request.GetToString()

How To Register New User Using Dwolla API

This started as a question, but in the process of posting this question, I solved it. So now, this is an FYI post...
==========
At first, whenever I tried to post to this URL, I would get an error message:
https:// www.dwolla.com/oauth/rest/register --> Bad URL
There is no operation listening for
http:// phx-dwol-web1.cloudworks.com/oauth/rest/register, but there is
an operation listening for
http:// www.dwolla.com/oauth/rest/register/, so you are being
redirected there.
I fixed by appending the auth values to the post URL:
https://www.dwolla.com/oauth/rest/register/?client_id={id}&client_secret={secret}
--> Good URL
Then, I was having trouble with request formatting. To fix this, make sure that you post JSON in the BODY of the post. Do NOT append to the URL, or submit as form fields.
Lastly, when I finally got a proper response from the Dwolla API, I was getting this error:
"New user must accept terms of service."
This is because the Dwolla API is CASE SENSITIVE, so the "ACCEPTTERMS" parameter in the JSON body must be submitted as "acceptTerms" in order for it to work.
Here is the documentation I am referencing:
http://developers.dwolla.com/dev/docs/register
Happy coding!
Thanks for the answer...it ultimately led to me solving my problem as well.
For completeness, I encountered this error when sending a poorly formed request to the api, where I had left off the trailing / before the get parameter {oauth_token}.
INCORRECT:
http://www.dwolla.com/oauth/rest/users?oauth_token={oauth_token}
CORRECT:
http://www.dwolla.com/oauth/rest/users/?oauth_token={oauth_token}

How to resolve error: "The post’s action links must be valid URLs"

Using the latest version of ShareKit to post URLs like so:
[SHKFacebook shareURL:[NSURL URLWithString:#"http://www.google.com"]];
is resulting in the following error message being displayed (in a web view):
Application response error
The post’s action links must be valid URLs. You can see this because you are one of the developers of the app.
What does this error message really mean, and (more importantly) how can it be fixed?
The problem occurs if 'SHKConfigMyAppURL' is not a valid URL.

Unable to get access token from Facebook. Got an OAuthException says "Error validating verification code"

I am using java and the purpose of my demo application is simple: Update user status.
I followed the Server-side Flow on page http://developers.facebook.com/docs/authentication. I got the auth dialog, facebook lead to the callback url and I got the code in my callback page. Then I failed when I try to generate an access token.
In the guide page, it says the following url could be used to generated an access token:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE
But what happens in my environment is I got the following error message:
{
"error": {
"type": "OAuthException",
"message": "Error validating verification code."
}
}
I am quite sure every parameter is correct because if I change the client_id value or client_secret parameter, I will got a different error message. The code parameter is what I got from facebook callback. So this should be correct, right? Really can't figure out what is the problem....
Any idea about this? I get stuck here...
I recently dealt with exactly this problem: everything matched, but it failed with the OAuthException. The thing that made it work was to change the redirect uri (in both requests for the flow) from:
http://foo.example.com
to
http://foo.example.com/
I.e., add the trailing slash. And then it worked. Stupid and silly, but there you go.
I had the same problem and tried the above suggestions. They helped, but in my case the problem was that my redir URL had a query parameter and Facebook wasn't cool with that. So, moral of the story is that the redir url you sent to exchange the token has to be identical the the original redir url and it can't have query parameters.
We had some fun with this as well.
In our case the trailing slash in the URL was already there, so I tried the Token we were using in the FB Debug Tool and it validated, so it looked like FB wasn't even seeing the Token in the request.
After some investigation I found the head-slapper - we doing a GET with HTTP Headers only not with a Querystring, so FB litterally wasn't seeing the Token at all.
The moral seems to be that if you can get the Token to validated in the FB Debug tool, there is likely /something/ amiss in your request -
It might be a missing "/" or some other mismatch with the App's defined URL (Domain mistmatch is a different error). I have not tried defining the App / Web Url for HTTPS and doing the request with HTTP but I suspect it would also hiccup somehow.
Or as in our case, the Request Method might be incorrect - GET with Headers or POSTing both throw the 2500, you have to do GET with a Querystring.
Hope that helps!
I had the same problem. It was a URL difference, but unlike the others that have posted, mine was the difference between HTTP and HTTPS.
We have BigIP handling HTTPS requests and forwarding over to an HTTP Apache server. When BaseFacebook's getCurrentUrl() function was called, it detected HTTP, and not the original HTTPS. I've modified that function like so:
protected function getCurrentUrl() {
if ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)) ||
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ||
(isset($_SERVER['HTTP_PSEUDOSSL']) && $_SERVER['HTTP_PSEUDOSSL'] == 'true')) {
$protocol = 'https://';
}
else {
$protocol = 'http://';
}
...
This version supports the HTTP_PSEUDOSSL key. I hope this helps someone.
Yes, the trailing slash worked for me too, thanks!
For debugging purposes, I found it helpful to use exactly the code fb provides on the developer page:
http://developers.facebook.com/docs/authentication/
Once you get that working, you can modify it to fit your own code.
I'm not sure, but you might also check to make sure your "Site URL" and "Site Domain" settings are correct on the App Edit screen, because according to the documentation, the redirect_uri must be in the same domain. (This is different from the canvas/tab page urls.)
I was also having a url problem, but the solution to it is different. I was passing the signedRequest that the JavaScript SDK returns to the server, and using the code value from that to request an access-token. However, according to some comments in the 3.1.1 version of the Facebook PHP SDK, the JavaScript SDK associates the code with a redirect_uri of empty string, i.e. "":
// the JS SDK puts a code in with the redirect_uri of ''
if (array_key_exists('code', $signed_request)) {
$code = $signed_request['code'];
$access_token = $this->getAccessTokenFromCode($code, '');
if ($access_token) {
// etc
}
}
After I changed my own server-side code to use a redirect_uri of "", then the request for an access-token worked.
in my case, my code wasn't working on IE.
The issue was in the following line
$user_id = $facebook->getUser();
if ($user_id)
Because somehow the getUser function always returned 0, so that condition was always true. Than he generated that error from invalid token.
Well, i fixed it by just saying this:
if ($user_id>0)
Silly stuff...