5

The latest version of the app (1.2.2.191) crashes when tapping the 'view tips and tricks' on the about view.

iPhone 4s/iOS 8.1.3, on the chance it's not universal

8
  • Probably some experimental feature, that doesn't work yet. Commented Feb 22, 2015 at 18:42
  • 2
    @ShadowWizard - no, I'm pretty sure it used to be a thing. Unless I'm getting confused with a different app.
    – Chris
    Commented Feb 22, 2015 at 19:06
  • Hmm... never noticed it before. Remember what it used to show? Commented Feb 22, 2015 at 20:09
  • 2
    @ShadowWizard Some app-related tips and tricks! ;-)
    – Chris
    Commented Feb 22, 2015 at 20:13
  • Nothing too exciting from memory, it was a long time ago id have last looked at it. (It could have been broken for months!)
    – Chris
    Commented Feb 22, 2015 at 20:15
  • That shouldn't be happening. I'm rerunning the build.
    – Brian Nickel StaffMod
    Commented Feb 23, 2015 at 17:48
  • Nope, that didn't work. Something weird's happening.
    – Brian Nickel StaffMod
    Commented Feb 23, 2015 at 17:55
  • @ShadowWizard - you can check it out now!
    – Chris
    Commented Feb 23, 2015 at 23:22

1 Answer 1

4

This will be fixed in the next release. There's weird stuff going on with Swift here.

The following code is working in debug builds but not release builds:

if let tips = NSArray(contentsOfFile: path) as? [String] {
    return tips
} else {
    fatalError("Could not load tips at path: \(path)")
}

I broke it down one step further and found that this code crashes:

if let tips = NSArray(contentsOfFile: path) {
    return tips as [String]
}

while this code works:

if let tips = NSArray(contentsOfFile: path) {
    println(tips)
    return tips as [String]
}

Because that's ugly, I'll be doing this instead:

if let tips = NSArray(contentsOfFile: path) {
    return map(tips, { $0 as String })
    // return tips as [String] // This fails in release builds. 😢
}

I'm suspecting that the casting behavior is different between the two builds and that there's a problem with deserialized arrays that they won't cast until fully resolved. I'll be testing this out in the latest Xcode beta and filing a radar.

1
  • This is fascinating, thanks for the full write up! Now the page opens, I was having a look through - there seems to be a mismatch of black/grey text on the screens which use bullet point lists - thought that probably wasn't worth its own post. Cheers!
    – Chris
    Commented Feb 23, 2015 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .