Error opening Modal view: "The URL can't be shown" - trigger.io

This is the error that appears in the console:
[WARNING] Modal webview error: Error Domain=WebKitErrorDomain Code=101
"The URL can’t be shown" UserInfo=0x8fee7e0
{NSErrorFailingURLKey=http%3A%2F%2Fimgur.com%2F59tSD.jpg,
NSErrorFailingURLStringKey=http%3A%2F%2Fimgur.com%2F59tSD.jpg,
NSLocalizedDescription=The URL can’t be shown}
I get the same error when loading a local file with:
forge.tabs.open('about.html');

In the former case it looks like you need to decode your url decodeURIComponent
In the later, you need to get the full path to the local file using forge.tools.getURL
This should work:
forge.tools.getURL('about.html', function(url) {
forge.tabs.open(url);
});

Related

UIWebView loads with error code -1008

Just playing around the UIWebView, I found some very interesting case...
When I hit a site with some xls file (say www.econ.yale.edu/~shiller/data/ie_data.xls) and now visit any other site and go back to the previous visited xls file. this file loads with an error and
webView(_ webView: UIWebView,didFailLoadWithError error: NSError?)
gets called with following error "resource unavailable", here is the destription
Error Domain=NSURLErrorDomain Code=-1008 "resource unavailable" UserInfo={NSErrorFailingURLKey=x-apple-ql-id://02C2F712-77CE-4015-8237-31BB4B203221/x-apple-ql-magic/Sheet0.html, NSLocalizedDescription=resource unavailable, NSErrorFailingURLStringKey=x-apple-ql-id://02C2F712-77CE-4015-8237-31BB4B203221/x-apple-ql-magic/Sheet0.html}
So guys I really curious to know what is this error all about and what -1008 error code says.
Note: This happens only in case of xls file

upload and save video from api with UISaveVideoAtPathToSavedPhotosAlbum

I have a video that is displayed through the one api in my application. I want to upload and save it on my device and I am using this code:
- (IBAction)saveMovie:(id)sender {
NSString *path = #"http://development.s3.amazonaws.com/uploads/f1a97ec0-e47f-470e-96a6-de98d2235dd0/Biceps.mp4";
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){
UISaveVideoAtPathToSavedPhotosAlbum(path, nil, nil, nil);
[self alert];
} else {
NSLog(#"incompatible video");
}
}
The link "path" is a own link to upload the file but also have the view link.
When I call the method that receives an answer
Video http://development.s3.amazonaws.com/uploads/f1a97ec0-e47f-470e-96a6-de98d2235dd0/Biceps.mp4 cannot be saved to the saved photos album: Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x1660f300 {NSErrorFailingURLStringKey=file:///http:/xerofit-development.s3.amazonaws.com/uploads/f1a97ec0-e47f-470e-96a6-de98d2235dd0/Biceps.mp4, NSErrorFailingURLKey=file:///http:/xerofit-development.s3.amazonaws.com/uploads/f1a97ec0-e47f-470e-96a6-de98d2235dd0/Biceps.mp4, NSLocalizedDescription=The requested URL was not found on this server., NSUnderlyingError=0x16542030 "The operation couldn’t be completed. No such file or directory", NSURL=file:///http:/xerofit-development.s3.amazonaws.com/uploads/f1a97ec0-e47f-470e-96a6-de98d2235dd0/Biceps.mp4}
what's wrong?
I tried to do it from NSTemporaryDirectory and it worked. It seems that if one accepts this way.
In my case I put this url
http://qa-elb-765904057.us-west-2.elb.amazonaws.com/plugin/execute?pluginName=xxxx&pluginMethod=xxxx&clientId=b0007920-88b4-11e5-a62a-fxxxxx&token=xxx94d60-91xx-11e5-a62a-f362d1d2xxx0&file_key=Mbxxx5v6RxxxQOR.mp4
and the error was this
Video /plugin/execute cannot be saved to the saved photos album: Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x176644e0 {NSErrorFailingURLStringKey=file:///plugin/execute, NSErrorFailingURLKey=file:///plugin/execute, NSLocalizedDescription=The requested URL was not found on this server., NSUnderlyingError=0x17661850 "The operation couldn’t be completed. No such file or directory", NSURL=file:///plugin/execute}
It seems that the entire url that was sending only detected this
/plugin/execute

Strange Behaviour while loading URL in Webview in IOS

It looks simple, but don't know what goes wrong. I am trying to load a basic URL in WebView, as shown below
WebsiteWebView.delegate=self;
NSURL* url = [NSURL URLWithString:#"http://firstclasspizzaoc.com/"];
[WebsiteWebView loadRequest:[NSURLRequest requestWithURL:url]];
while loading i am getting below error everytime..
Error : Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0xe036d20 {NSErrorFailingURLKey=http://firstclasspizzaoc.com/, NSErrorFailingURLStringKey=http://firstclasspizzaoc.com/}
2014-01-07 15:18:46.142 FirstClassPizza[1583:
Error : Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0xe0ef310 {NSErrorFailingURLStringKey=XXXXXXXX, NSErrorFailingURLKey=XXXXXXXX, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0xcbe9130 "A server with the specified hostname could not be found."}
At Browser it is loading perfectly..
Please suggest what went wrong in my code..
Any Valuable suggestions will be appreciated...
Thanks
It is due to Your Web URL http://firstclasspizzaoc.com/ can you use your url with
http://www.firstclasspizzaoc.com/
You can find your answer here :
How do I fix NSURLErrorDomain error -999 in iPhone 3.0 OS
This thread contained this description for this error: "This error may occur if an another request is made before the previous request of WebView is completed..."
I worked around this by ignoring this error and letting the webview continue to load.
if ([error code] != NSURLErrorCancelled) {
//show error alert, etc.
}

initWithContentsOfURL returns nil only in iOS 5.x [duplicate]

I have been stuck with this for a while and don't seem to get around this.
I am trying to read the contents of an URL as a string from an URL, But i get a weird
Error -> Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)"
My code :
fetchedString = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:#"www.example.com/iphone"] encoding:NSUTF8StringEncoding error:&error];
NSLog(#"%#",fetchedString);
// if there is something wrong with the URL
if (error) {
NSLog(#"Error -> %#", error);
return ;
}
What am I doing wrong? I tried using getting as NSData as well, but I get null back.
Yes, the URL is missing the scheme: "http://".
"Error -> Error Domain=NSCocoaErrorDomain Code=256"
For the error code check the Apple documentation:
NSError codes in the Cocoa error domain.
NSFileReadUnknownError = 256,
NSFileReadUnknownError
"Read error, reason unknown"
Not that the error definition is very helpful. :-)
Also do not check if error is nil to determine if there is an error, check the return value for nil. error is not guaranteed to be nil on successful execution.
I had a similar problem accessing files located on my device. I followed NSURL isFileURL always returns NO
and used [NSURL fileURLWithPath] instead of [NSURL URLWithString] - this worked!
I got this error (Error Domain=NSCocoaErrorDomain Code=256) as soon as our ssl certificate expired. that may not help you but could help someone else.
Sandboxing
If you're using sandboxing in your app, you might want to check that com.apple.security.network.client is set to YES. It's in the the General tab of your Target in Xcode 5 under
Network: Outgoing Connections (Client)
Also be aware that if you see a code 257 when trying to reach a file:/// url, that's also probably because of sandboxing, but this time rather the File Access part. Because I didn't want to open it to anything else than `com.apple.security.files.user-selected.read-write'
User selected files
I preferred to use A Dead Simple Fileserver and use http://localhost:3000 when in Debug mode.
More reasons that might be causing this specific error:
SSL is misconfigured on the server
The server redirects (301) the http URL to https (see #1)
App transport security also uses this code for blocked requests.
I got the same error. The above marked answer is perfect. But in my case, I had the "http://" in the url but had to add the port number in the url request since there is a service running on a specific port that is actually responding to your request.
#"http://example.com:8084/yyy.zzz"
I got the same error, the above solution didn't work for me, in my case i was calling dataWithContentsOfURL from within a UNNotificationServiceExtension so i had to update the info.plist file of the UNNotificationServiceExtension with the app transport security entries.

checkResourceIsReachableAndReturnError always return Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)"

I am trying to use: checkResourceIsReachableAndReturnError of NSURL class
But I always get FALSE and the NSError shows : Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)"
I checked the URL with safary and it works, any idea?
This is not the method you are looking for. The description of the method in NSURL's class reference states:
Returns whether the resource pointed to by a file URL can be reached.
The method should be used to test reachability of file URLs, you cannot check whether an internet resource is available or not using this method.
You'll find several answers in stack overflow if you search for reachability testing or something similar.. However, you could probably just attempt to reach the URL and handle the error if that fails.

Resources