1

I'm trying slightly different than what the instructor has asked to do -

After pressing the snail button to play the audio slowly, another view controller will show up with a label "Playing slowly" and a stop button.

The action for the stop button in this new view controller is to stop the audio the previous view controller has started.

I did some googling and found the following snipped of code will pass variables from one view controller to another:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
    if (segue.identifier == "btnSubmitSegue") {
        var playslow = segue.destinationViewController as! PlaySlowViewController
        playslow.audioPlayer2 = audioPlayer
    }
}

When I did this I'm seeing the following error:

Thread 1: EXC_BAD_ADDRESS (code=1, address = 0x38)

I did some googling with this error message and looks like some memory corruption. Has anyone seen this kind of problem and knows how to solve it?

nhgrif
  • 61,578
  • 25
  • 134
  • 173
user2183990
  • 61
  • 1
  • 1
  • 2
  • possible duplicate of [How do you share data between view controllers and other objects in Swift?](http://stackoverflow.com/questions/29734954/how-do-you-share-data-between-view-controllers-and-other-objects-in-swift) – nhgrif May 24 '15 at 16:30
  • `as!` is a red-flag for me, by the way... – nhgrif May 24 '15 at 16:31

0 Answers0