Monday 15 April 2013

ios - Swift - release build crashes unless I turn off optimization -


It's on XCode 6.2.

If I run in Apple release mode it will crash, but it does not crash with optimization. The code looks simple. I've done an overdose program for over a decade, so new to programming Not, etc.

I think that in 32 bit it's ok in the release mode (Fast-O), but 64-bit crashes on real iOS hardware

Is this a compiler bug? Or is it possible that only some compiler crashes for settings (which can be in C!), May be bad speed.

I include the code, but I'm not sure that it will help. class func trylogin (completionHandler: (result: JSON ?, error: NSError?) -> ()) {// It seems that these variables are fully optimized in 64 blocks Are not working with. Email = user.mail password = user Enter password / setup login Parameter: [String: AnyObject] = ["Action": "Login", "Login": ["Email": Email, "Password": Password, "Type": User. Type]] // Fire of the Rust Post Asynchronous request (.Post, Basic URL, parameters: parameters, encoding: .json) .responseSwiftyJSON {In the release mode on 64 bit in (Request, Feedback, JasonDict, Error), things here seriously Println ("jsonDict login attempt:") Print (jsonDict) if token = jsonDict ["login"] ["token"] string {println ("got token:" + token) User.token = token; User.email = email; User.password = password; Complete handler (results: jasondict, error: zero)} other {println ("not token") User.token = ""; User.email = ""; User.password = ""; Complete the Handsler (result: jsonDict, error: error)}}}

error = NSError (domain: "stethIoUser", code: 404, userInfo: Div class = "post-text" itemprop = "text">

I had a similar situation yesterday.

I was running 6.2 Xcode.

If I run my app in release mode it will crash, but did not crash in optimization from release mode. (It was fine in debug mode.)

The problem? This line of code:

  bear = split (column liter, {$ 0 == ","})  

Yes. That was it. The Partition function did not just divide my string. Instead, it handed the whole original string to the first element of the parts array. Not surprisingly, this later a crash in the app later.

I changed that line of code with it, and it worked:

  bears = column litter.captetscaptatedbest string (",")  

This bug was especially difficult to track down for the following reasons:

  1. The experiment was fine during the trial, as it was compiled in debug mode. To realize that the only accident took some time to end other factors (iOS version, Prod vs. test data) in release mode.

  2. The app worked in release mode We stopped optimization

  3. The accident caused by a new code introduced from our previous successful release version It was not related, which we had deployed two months ago. We were still using the split function without any problem.

  4. This problem was not on the line of code. As a result of not breaking the string, this app happened later.

  5. There was not a compiled error compiled in the code release mode that was pointing to an issue with the split function. Did not split.

I have not tested it on version 6.3 or later on Xcode. (For other reasons, we were prevented from upgrading to Xcode 6.3 / SWIFT 1.2, but will be upgraded soon.)


No comments:

Post a Comment