kekub
kekub

Reputation: 872

iOS App keeps crashing for reviewer, but works fine in field tests

my iOS app keeps crashing for the iOS reviewer team, but works fine on all kind of test flight devices (~10). I am unable to reproduce the problem.

The crash log the reviewer team sent me states

Incident Identifier: 6686BE5C-DCC1-48C1-9AC2-FCFF85F3EBC2
...
Version:             4 (2.1)
Code Type:           ARM-64 (Native)
...
Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010012e218
Triggered by Thread:  5
...

Thread 5 name:  Dispatch queue: com.apple.root.default-qos
Thread 5 Crashed:
0   Alamofire                       0x000000010012e218 Alamofire.request (Alamofire.Method, Alamofire.URLStringConvertible, parameters : [Swift.String : Swift.AnyObject]?, encoding : Alamofire.ParameterEncoding) -> Alamofire.Request (Alamofire.swift:1522)
1   Alamofire                       0x000000010012e058 Alamofire.request (Alamofire.Method, Alamofire.URLStringConvertible, parameters : [Swift.String : Swift.AnyObject]?, encoding : Alamofire.ParameterEncoding) -> Alamofire.Request (Alamofire.swift:1522)
2   Stundenplan                     0x000000010009d4c4 function signature specialization <Arg[0] = Owned To Guaranteed> of Stundenplan.TimeTableManager.loadRemote (Stundenplan.TimeTableManager)() -> () (TimeTableManager.swift:103)
3   Stundenplan                     0x000000010009e434 Stundenplan.TimeTableManager.(reload (Stundenplan.TimeTableManager) -> () -> ()).(closure #1) (TimeTableManager.swift:58)
4   libdispatch.dylib               0x0000000197b29990 _dispatch_call_block_and_release + 20
5   libdispatch.dylib               0x0000000197b29950 _dispatch_client_callout + 12
6   libdispatch.dylib               0x0000000197b3677c _dispatch_root_queue_drain + 1844
7   libdispatch.dylib               0x0000000197b37c48 _dispatch_worker_thread3 + 104
8   libsystem_pthread.dylib         0x0000000197d09228 _pthread_wqthread + 812
9   libsystem_pthread.dylib         0x0000000197d08eec start_wqthread + 0

which seems to point to Alamofire, but I have not found a single report about anything even close to this.

I double checked my code for anything that could go wrong, but I still have no idea, why it keeps crashing.

func loadRemote() {
    if let timeTableName = NSUserDefaults.standardUserDefaults().stringForKey("timeTable") {
        // Prevent server flooding
        if let lastUpdate = lastUpdate where lastCourse == timeTableName {
            if NSDate.minutesBetween(date1: lastUpdate, date2: NSDate()) < 5 {
                return ;
            }
        }

        lastUpdate = NSDate()
        lastCourse = timeTableName

        let icalLink = "http://****/ical/\(timeTableName).ics"
        UIApplication.sharedApplication().networkActivityIndicatorVisible = true
        Alamofire.request(.GET, icalLink).responseString { (_, _, data, err) in
            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
            if(err != nil) {
                PiwikTracker.sharedInstance().sendExceptionWithDescription("Server unreachable.", isFatal: true)
            } else {
                if let cache = NSUserDefaults.standardUserDefaults().stringForKey("icsCache") {
                    if data == cache {
                        return
                    }
                }
                TimeTable(icalString: data!, success: { (timeTable) in
                    self.currentData = timeTable
                    NSUserDefaults.standardUserDefaults().setValue(data, forKey: "icsCache")
                    }, error: {
                        println("error parsing timetable")
                })
            }
        }
    }
}

Any help is much appreciated.

Thank you in advance!

Upvotes: 2

Views: 608

Answers (1)

Tommy
Tommy

Reputation: 100622

SIGTRAP probably means an exception was thrown.

I can find at least one instance in which AlamoFire could raise an exception. That was fixed last October. While it's possible you've not updated your copy of AlamoFire, I think the invalid characters in the URL clue is likely to be helpful given that you form the URL by directly pasting in a string from the user defaults.

I'd therefore suggest that the fix is to sanitise timeTableName during creation to only URL-safe characters.

Upvotes: 1

Related Questions