I'm using the Google API with xamarin ios. I'm trying to use the
Schema of URLs of Google Maps to do a search of a site .. this is my code..
if (UIApplication.SharedApplication.CanOpenUrl(new NSUrl("comgooglemaps://")))
{
var pizza = "comgooglemaps://" + "?q=Pizza¢er=37.759748,-122.427135";
var busqPizza = new NSUrl(pizza);
UIApplication.SharedApplication.OpenUrl(busqPizza);
}
else {
Console.WriteLine("No puede usar comgooglemaos://");
}
error..
-canOpenURL: failed for URL: "comgooglemaps://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
I have found a solution but I do not know if it is the correct form but I work. This is the solution instead of using comgooglemaps:// use http://maps.apple.com?xxxxxx
var pizza = "http://maps.apple.com?q=Pizza¢er=20.661922,-103.392030";
UIApplication.SharedApplication.OpenUrl(NSUrl.FromString(pizza));
Related
I'm trying to upload an image to a FTP server using swift 4
I used FileProvider which is a library for Ftp connection iOS
anyway I'm checking the provider is reachable. and Im getting this error
The operation couldn’t be completed. (NSURLErrorDomain error -1011.)
this is the full error object:
Error Domain=NSURLErrorDomain Code=-1011 "(null)" UserInfo={NSErrorFailingURLKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSErrorFailingURLStringKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSURL=ftp://xxxx.xxxx.xxxx.xxxx:21/}
this is my code:
self.ftpProvider!.isReachable { (flag, error) in
if flag {
print("RIZK:--- provider is reachable ")
let progress = self.ftpProvider!.copyItem(localFile: localURL, to: "/files/\(imageName)", overwrite: true, completionHandler: { (error) in
if error == nil {
print("RIZK:-- Ready to upload")
}else{
print("RIZK:--\(error?.localizedDescription ?? "")")
}
})
print(progress?.fractionCompleted ?? 0)
}else{
print("RIZK:--- provider not reachable, with error \(error?.localizedDescription ?? "") ")
}
}
So I'm trying to get FB and Twitter to respond from tappin on a table cell:
I set up the plist:
Then I created this function:
func schemeAvailable(scheme: String) -> Bool {
if let url = URL(string: scheme) {
return UIApplication.shared.canOpenURL(url)
}
return false
}
Then I tried to use it:
print(UIApplication.shared.canOpenURL(URL(string: "fb:")!))
if(schemeAvailable(scheme: "fb://")){
print("facebook agailable")
}
if(schemeAvailable(scheme: "twitter://")){
print("twitter agailable")
}
and get back a response of:
2016-10-03 17:04:09.096 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
false
2016-10-03 17:04:09.097 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "fb://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-10-03 17:04:09.098 JSONTesting[73245:2492124] -canOpenURL: failed for URL: "twitter://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
I've tried with and without the // in the string but to no avail...get the same error back every time.
Thanks
I'm trying to share an object which I've create at the objects tab at the open graph section.
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = message;
gameRequestContent.title = title;
gameRequestContent.recipients = #[#"400098323516165"];
gameRequestContent.actionType = actionType;
gameRequestContent.objectID = #"123456"; //I also tried by the name : bingoclimb:life
FBSDKGameRequestDialog* dialog = [[FBSDKGameRequestDialog alloc] init];
dialog.frictionlessRequestsEnabled = YES;
dialog.content = gameRequestContent;
dialog.delegate = self;
[dialog show];
My objects section looks like this:
If I try with this code (with the id) I get the following error:
Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be
completed. (com.facebook.sdk.share error 2.)" UserInfo=0x170c6cdc0
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Sorry, this feature
isn't available right now: An error occurred while processing this
request. Please try again later.}
If I try with the objectId as name I get the following error:
Error Domain=com.facebook.sdk.share Code=100 "The operation couldn’t
be completed. (com.facebook.sdk.share error 100.)"
UserInfo=0x17066eb40
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid fbid.}
Note: the user has publish_actions permission.
Also, when I copy the creation code from the "Sample code for object" and run it I get the following error:
Error Domain=com.facebook.sdk.share Code=201 "The operation couldn’t
be completed. (com.facebook.sdk.share error 201.)"
UserInfo=0x17046a240
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error creating Open
Graph object: Error Domain=com.facebook.sdk.core Code=8 "The operation
couldn’t be completed. (com.facebook.sdk.core error 8.)"
UserInfo=0x1701accc0
{NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter:
0x170016150>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1,
NSLocalizedRecoverySuggestion=The server is temporarily busy, please
try again., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown
error has occurred.,
com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500,
com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1,
NSLocalizedRecoveryOptions=(
OK ), com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = "BGhIEBfOI+b";
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500; }}, NSUnderlyingError=0x17005abb0 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)"}
I'm trying to query National Rail Enquiries using their API found below however I'm having some issues.
http://lite.realtime.nationalrail.co.uk/openldbws/
I'm attempting to use the SOAPEngine64 framework (https://github.com/priore/SOAPEngine) to simplify the process of making the requests (using Swift) but I don't seem to be able to get any results back.
Every time I run the following code I get this error printed out. Does anyone know where I'm going wrong?
Error:
2015-03-28 13:46:09.528 Rapid Rail UK[18994:1032065] Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x7fd9a9c35e80 {NSErrorFailingURLKey=https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2014-02-20, NSErrorFailingURLStringKey=https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2014-02-20}
Swift Code:
var token = "<com:AccessToken><com:TokenValue>MY_TOKEN_KEY</com:TokenValue></com:AccessToken>"
var soap = SOAPEngine()
soap.header = token
soap.actionNamespaceSlash = true
var args = [
"numRows" : 10,
"crs" : "GTW"
];
soap.requestWSDL("https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2014-02-20",
operation: "GetDepartureBoard",
value: args,
completeWithDictionary: { (statusCode : Int,
dict : [NSObject : AnyObject]!) -> Void in
var result:Dictionary = dict as Dictionary
NSLog("%#", result)
}) { (error : NSError!) -> Void in
NSLog("%#", error)
}
Don't use requestWSDL, use requestURL, without wsdl extension, call directly the asmx service (https://lite.realtime.nationalrail.co.uk/OpenLDBWS/ldb6.asmx), and try to set the soapAction to http://thalesgroup.com/RTTI/2014-02-20/ldb/GetDepartureBoard. This is because the WSDL not contains soapAction attributes, but needed for the correct parsing of the WSDL definitions.
I am trying to read a source code of a site from its URL.
Below is my code.
let myURLString = "https://theUrlOfTheSite"
let myURL = NSURL(string: myURLString)
var error: NSError?
let myHTMLString = String(contentsOfURL: myURL!, encoding: NSUTF8StringEncoding, error: &error)
if let error = error {
println("Error : \(error)")
} else {
println(myHTMLString)
}
It works for some site, but not for others. I get the following error
2014-12-21 19:11:54.032 MyPlayground[2912:345862] NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807)
Error : Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)"
I think it's because the site is https, not http. (I don't really know about this stuff but..SSL something??)
So my question is, what should I do to make my code work??
I searched for hours but I'm new to iOS and Swift, so no progress.
Do I have to make NSURLConnection or something? Because all I want to do is get the source code. Must be a simple job I guess..
Any help will be appreciated. Thanks in advance.