unwrap

UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]

眉间皱痕 提交于 2019-12-04 05:41:43
问题 I know that this question has been answered before, but none of the responses seem to help me, since i am not using a datasource in my project. I a have a Maven project, integrated with Spring and Hibernate, connecting to a SQL Server 2014 database. This is my pom.xml, where you can see the versions: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0

“Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?' ?”

杀马特。学长 韩版系。学妹 提交于 2019-12-04 02:24:22
I have not been studying iOS or Swift for very long. With one of the latest Xcode updates, many of the apps I have made on my computer now appear to be using obsolete syntax. Xcode talks us through converting it to new syntax but often that does not solve anything and I have a new problem. Here is code for one of the first app I made after the syntax has been converted. I am getting an error saying: Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?' ? I know this must be really simple but I don't know how to fix it. Here is my code: @IBAction func findAge(sender:

How to unwrap the content value from XML in Objective-C

吃可爱长大的小学妹 提交于 2019-12-02 23:19:01
问题 I'm receiving correctly in XML file the value in debug. - (void)connectionDidFinishLoading:(NSURLConnection *)connection { LogDebug(TAG_SETTINGS, @"Provisioning file downloaded, %lu bytes", (unsigned long)[self.provisioningData length]); NSString *content = [[NSString alloc] initWithData:self.provisioningData encoding:NSUTF8StringEncoding]; LogDebug(TAG_SETTINGS, @"Downloaded data: \n%@", content); NSLog(@"Steve note:Here is the content of provisioning profile%@",content); } The content that

Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?

妖精的绣舞 提交于 2019-12-02 04:49:17
问题 I define a class in Swift like that: class RecordedAudio: NSObject { var title: String! var filePathUrl: NSURL! init(title: String, filePathUrl: NSURL) { self.title = title self.filePathUrl = filePathUrl } } After that, I declare the global var of this one in controller var recordedAudio: RecordedAudio! And then, create the instance in this function: func audioRecorderDidFinishRecording(recorder: AVAudioRecorder!, successfully flag: Bool) { if(flag){ // save recorded audio recordedAudio =

Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?

烂漫一生 提交于 2019-12-02 02:17:27
I define a class in Swift like that: class RecordedAudio: NSObject { var title: String! var filePathUrl: NSURL! init(title: String, filePathUrl: NSURL) { self.title = title self.filePathUrl = filePathUrl } } After that, I declare the global var of this one in controller var recordedAudio: RecordedAudio! And then, create the instance in this function: func audioRecorderDidFinishRecording(recorder: AVAudioRecorder!, successfully flag: Bool) { if(flag){ // save recorded audio recordedAudio = RecordedAudio(title: recorder.url.lastPathComponent, filePathUrl: recorder.url) ... But I got the error

Function throws AND returns optional.. possible to conditionally unwrap in one line?

◇◆丶佛笑我妖孽 提交于 2019-11-28 13:42:27
I am using an SQLite library in which queries return optional values as well as can throw errors. I would like to conditionally unwrap the value, or receive nil if it returns an error. I'm not totally sure how to word this, this code will explain, this is what it looks like: func getSomething() throws -> Value? { //example function from library, returns optional or throws errors } func myFunctionToGetSpecificDate() -> Date? { if let specificValue = db!.getSomething() { let returnedValue = specificValue! // it says I need to force unwrap specificValue, // shouldn't it be unwrapped already? let

Function throws AND returns optional.. possible to conditionally unwrap in one line?

試著忘記壹切 提交于 2019-11-27 07:54:00
问题 I am using an SQLite library in which queries return optional values as well as can throw errors. I would like to conditionally unwrap the value, or receive nil if it returns an error. I'm not totally sure how to word this, this code will explain, this is what it looks like: func getSomething() throws -> Value? { //example function from library, returns optional or throws errors } func myFunctionToGetSpecificDate() -> Date? { if let specificValue = db!.getSomething() { let returnedValue =