upload and save video from api with UISaveVideoAtPathToSavedPhotosAlbum - ios

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

Related

Getting "null" reverseGeocodeCoordinate method with GMSMap in iOS?

I am using the following code to get address from lat and long:
NSLog(#">>>>%f,%f",location.latitude,location.longitude);
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:location completionHandler:^(GMSReverseGeocodeResponse *resp, NSError *error)
{
NSLog(#"response%#",resp);
}];
When I try to do geocode with a correct lat and long, for a particular location, I get null as response and error is this. This is not happening with my android device.
I can see response as nil and error is:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, _kCFStreamErrorCodeKey=-2102, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x1659ae80 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSErrorFailingURLStringKey=https://clients4.google.com/glm/mmap, NSErrorFailingURLKey=https://clients4.google.com/glm/mmap, NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4}}}
This issue arises because of your API key is expired, if you regenerate the API key in google console it will work and get your response
API key example: AIzaSyDleduRwellp3OwLMAOzLt4MZWsJMWqMvM
Also check, if you're using simulator, that your simulator location setting is set to none. You can check via selecting your simulator and go to:
Debug > Location > none
Hope it helps.

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.
}

AVAssetExportSessionStatusFailed randomly to write the video

I am creating the video from a set of images with AVAssetwriter and AVAssetExportSession and successfully getting the video and save it to the documents. But randomly the video exporting failed and it shows An Unknown error occured with error code -11800.
ExportSessionError: -11800 adn userinfo{
NSLocalizedDescription = "The operation could not be completed";
NSLocalizedFailureReason = "An unknown error occurred (-12124)";
NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-12124 \"The operation couldn\U2019t be completed. (OSStatus error -12124.)\"";
This is the error console i got.. Please help me.. Thanks

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.

Error opening Modal view: "The URL can't be shown"

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);
});

Resources