SOAPEngine requestURL -> 无法调用非函数类型的值 'NSURL' Swift
SOAPEngine requestURL -> cannot call value of non-function Type 'NSURL' Swift
我从 Github 下载 priore/SOAPEngine。我想测试这个框架并想询问 w3 web 服务,在开发人员的领域中是这些步骤的测试代码,但在 objective - c.我希望在 swift 2.0 在 Xcode 7.1
中执行此操作
let soap = SOAPEngine()
soap.actionNamespaceSlash = true
soap.setValue(txt_cel.text, forKey: "Celsius")
soap.requestURL("http://www.w3schools.com/webservices/tempconvert.asmx",
soapAction: "http://www.w3schools.com/webservices/CelsiusToFahrenheit", completeWithDictionary: { (statusCode : NSInteger, stringXML : NSString) -> Void in
lbl_Info.text = "Result :" + soap.floatValue()
}) { (error : NSError!) -> Void in
lbl_Info.text = "error"
}
我在 soap.reqestURL(...) 上收到错误 -> 无法调用非函数类型的值 'NSURL'
他们在 swift 的 zip 中有一个项目,他们也这样做:
soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
soapAction: "http://www.prioregroup.com/GetVerses",
completeWithDictionary: { (statusCode : Int, dict : [NSObject : AnyObject]!) -> Void in
var book:Dictionary = dict as Dictionary
let verses:NSArray = book["BibleBookChapterVerse"] as! NSArray
self.verses = verses
self.table.reloadData()
}) { (error : NSError!) -> Void in
NSLog("%@", error)
}
有人可以帮我找出项目中的问题吗?
格雷茨
好的,我有答案了:)
我更改此代码:
(statusCode : NSInteger, stringXML : NSString)
有了这个
(NSInteger statusCode, NSString stringXML )
比我更改这些代码:
lbl_Info.text = "Result :" + soap.floatValue(); lbl_Info.text = "error"
收件人:
self.message = String(soap.floatValue()); self.message = String(error)
:) 就是这样!
问候
正确的声明是:
soap.setValue("30", forKey: "Celsius")
soap.requestURL("http://www.w3schools.com/webservices/tempconvert.asmx",
soapAction: "http://www.w3schools.com/webservices/CelsiusToFahrenheit",
completeWithDictionary: { (statusCode: Int, dict : [NSObject: AnyObject]!) -> Void in
//let result:Dictionary = dict as Dictionary
NSLog("%f", soap.floatValue());
}, failWithError: { (error : NSError!) -> Void in
NSLog("%@", error)
})
我从 Github 下载 priore/SOAPEngine。我想测试这个框架并想询问 w3 web 服务,在开发人员的领域中是这些步骤的测试代码,但在 objective - c.我希望在 swift 2.0 在 Xcode 7.1
中执行此操作let soap = SOAPEngine()
soap.actionNamespaceSlash = true
soap.setValue(txt_cel.text, forKey: "Celsius")
soap.requestURL("http://www.w3schools.com/webservices/tempconvert.asmx",
soapAction: "http://www.w3schools.com/webservices/CelsiusToFahrenheit", completeWithDictionary: { (statusCode : NSInteger, stringXML : NSString) -> Void in
lbl_Info.text = "Result :" + soap.floatValue()
}) { (error : NSError!) -> Void in
lbl_Info.text = "error"
}
我在 soap.reqestURL(...) 上收到错误 -> 无法调用非函数类型的值 'NSURL'
他们在 swift 的 zip 中有一个项目,他们也这样做:
soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
soapAction: "http://www.prioregroup.com/GetVerses",
completeWithDictionary: { (statusCode : Int, dict : [NSObject : AnyObject]!) -> Void in
var book:Dictionary = dict as Dictionary
let verses:NSArray = book["BibleBookChapterVerse"] as! NSArray
self.verses = verses
self.table.reloadData()
}) { (error : NSError!) -> Void in
NSLog("%@", error)
}
有人可以帮我找出项目中的问题吗?
格雷茨
好的,我有答案了:) 我更改此代码:
(statusCode : NSInteger, stringXML : NSString)
有了这个
(NSInteger statusCode, NSString stringXML )
比我更改这些代码:
lbl_Info.text = "Result :" + soap.floatValue(); lbl_Info.text = "error"
收件人:
self.message = String(soap.floatValue()); self.message = String(error)
:) 就是这样!
问候
正确的声明是:
soap.setValue("30", forKey: "Celsius")
soap.requestURL("http://www.w3schools.com/webservices/tempconvert.asmx",
soapAction: "http://www.w3schools.com/webservices/CelsiusToFahrenheit",
completeWithDictionary: { (statusCode: Int, dict : [NSObject: AnyObject]!) -> Void in
//let result:Dictionary = dict as Dictionary
NSLog("%f", soap.floatValue());
}, failWithError: { (error : NSError!) -> Void in
NSLog("%@", error)
})