-1

I know it sound stilly but this is what happening with my code, On simulator; application works on iPhone SE, iPhone 7 but all other device gives me an error. I don't understand. If the code is wrong then why it works on my different device on simulator

func startTimer (){
    timer = Timer.scheduledTimer(timeInterval:TimeInterval(timerBetweenNumbers) , target: self, selector: (#selector(PlayViewController.randomInt)), userInfo: nil, repeats: true)
}

ERROR : 2017-03-23 14:27:15.984926 Anzan[3249:129679] [aqme] 255: AQDefaultDevice (1): skipping input stream 0 0 0x0 fatal error: unexpectedly found nil while unwrapping an Optional value

I am using Xcode 8 and Swift 3

Thanks in advance for help

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AliAzra
  • 889
  • 1
  • 9
  • 28
  • Is the crash happening on the line of code you posted? How is `timerBetweenNumbers` declared? How is its value set? [Edit] your question with that relevant code. – rmaddy Mar 23 '17 at 14:32
  • print value for - timerBetweenNumbers at first line of this function. Also share, code for function PlayViewController.randomInt.. to get better help – Krunal Mar 23 '17 at 14:42
  • Possible duplicate of [fatal error: unexpectedly found nil while unwrapping an Optional value](http://stackoverflow.com/questions/24948302/fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-value) – Losiowaty Mar 23 '17 at 14:45
  • There are a lot of questions with good answers regarding "unexpectedly found `nil` while unwrapping an `Optional`". Have you looked at them? Why did they not help you? – Losiowaty Mar 23 '17 at 14:46

1 Answers1

0

Thanks a lot for help Also I found the issue with my App.

"TimerBetweenNumbers" value was suppose to be read from DataCore. I didn't know that in Xcode, each simulator device has his own DataCore.

I thought DataCore was similar to SQL DataBase and no matter what device you use, they all read the same Database.

AliAzra
  • 889
  • 1
  • 9
  • 28