找不到坠机试飞的原因
Can not find reason for crash test flight
只有我的一位测试飞行 Beta 测试员报告了一次坠机事件。两个月以来,我一直在摸不着头脑,为什么它会为他们而不是其他人崩溃。我无法自己重现崩溃,因此必须通过带有 iTunes 连接的试飞系统提交新版本,并等待用户对其进行测试,然后我才能知道我是否取得了进展。这是一个非常缓慢和乏味的过程,所以我在这里恳求你的知识,并帮助我首先理解为什么应用程序只为这个用户(共 12 个)崩溃。
我从试飞中得到的坠机报告是
> Incident Identifier: 64F2AB18-E3F4-48A2-A865-CCAB2FF2BF12
Beta Identifier: 5E64ED31-B493-4406-94E5-E4233A84D2A6
Hardware Model: iPhone6,2
Process: anAppName [2491]
Path: /private/var/mobile/Containers/Bundle/Application/0C971485-F0ED-4CA0-96F7-AF9EA7A71A30/anAppName.app/anAppName
Identifier: com.aCleverName.anAppName
Version: 1.0.9.8.1 (1.0)
Beta: YES
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-10-16 11:39:04.04 +0100
Launch Time: 2015-10-16 11:38:54.54 +0100
OS Version: iOS 9.0.2 (13A452)
Report Version: 105
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000d6b24
Triggered by Thread: 0
Global Trace Buffer (reverse chronological seconds):
0.467279 CFNetwork 0x0000000183f919a4 TCP Conn 0x1545fb500 SSL Handshake DONE
0.722080 CFNetwork 0x0000000183f918b4 TCP Conn 0x1545fb500 starting SSL negotiation
0.722520 CFNetwork 0x0000000184033760 TCP Conn 0x1545fb500 complete. fd: 7, err: 0
0.723794 CFNetwork 0x0000000184034c8c TCP Conn 0x1545fb500 event 1. err: 0
0.761090 CFNetwork 0x0000000184034d64 TCP Conn 0x1545fb500 started
0.764039 CFNetwork 0x000000018408a5a4 Creating default cookie storage with default identifier
0.764039 CFNetwork 0x000000018408a570 Faulting in CFHTTPCookieStorage singleton
0.764039 CFNetwork 0x00000001840dc498 Faulting in NSHTTPCookieStorage singleton
6.422985 AppleJPEG 0x000000018bb02348 [0x1550bb000] Created session
6.435154 AppleJPEG 0x000000018bb02348 [0x15487f600] Created session
6.480890 AppleJPEG 0x000000018bb02348 [0x1550c1000] Created session
6.952666 CFNetwork 0x0000000183f919a4 TCP Conn 0x1546a5230 SSL Handshake DONE
7.034320 CFNetwork 0x0000000183f918b4 TCP Conn 0x1546a5230 starting SSL negotiation
7.035121 CFNetwork 0x0000000184033760 TCP Conn 0x1546a5230 complete. fd: 6, err: 0
7.036622 CFNetwork 0x0000000184034c8c TCP Conn 0x1546a5230 event 1. err: 0
7.607332 CFNetwork 0x0000000184034d64 TCP Conn 0x1546a5230 started
7.726344 CFNetwork 0x0000000183f919a4 TCP Conn 0x154670e50 SSL Handshake DONE
7.868298 CFNetwork 0x0000000183f919a4 TCP Conn 0x1546408d0 SSL Handshake DONE
7.877690 CFNetwork 0x0000000183f918b4 TCP Conn 0x154670e50 starting SSL negotiation
7.878310 CFNetwork 0x0000000184033760 TCP Conn 0x154670e50 complete. fd: 7, err: 0
7.879900 CFNetwork 0x0000000184034c8c TCP Conn 0x154670e50 event 1. err: 0
7.979690 CFNetwork 0x0000000183f918b4 TCP Conn 0x1546408d0 starting SSL negotiation
7.981042 CFNetwork 0x0000000184033760 TCP Conn 0x1546408d0 complete. fd: 6, err: 0
7.982874 CFNetwork 0x0000000184034c8c TCP Conn 0x1546408d0 event 1. err: 0
8.939527 CFNetwork 0x0000000184034d64 TCP Conn 0x154670e50 started
9.065458 CFNetwork 0x0000000184034d64 TCP Conn 0x1546408d0 started
Thread 0 name:
Thread 0 Crashed:
0 anAppName 0x00000001000d6b24 specialized MeetUpsListDisplayTableViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (MeetUpsListDisplayTableViewController.swift:141)
1 anAppName 0x00000001000d48f0 @objc MeetUpsListDisplayTableViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (MeetUpsListDisplayTableViewController.swift:0)
2 UIKit 0x000000018a125660 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 688
3 UIKit 0x000000018a1257b8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
4 UIKit 0x000000018a1153b8 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2440
5 UIKit 0x000000018a12a348 -[UITableView _performWithCachedTraitCollection:] + 104
6 UIKit 0x0000000189ecba74 -[UITableView layoutSubviews] + 176
7 UIKit 0x0000000189ddeff0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 644
8 QuartzCore 0x00000001895e5f14 -[CALayer layoutSublayers] + 148
9 QuartzCore 0x00000001895e0b20 CA::Layer::layout_if_needed(CA::Transaction*) + 292
10 QuartzCore 0x00000001895e09e0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
11 QuartzCore 0x00000001895e007c CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x00000001895dfdd0 CA::Transaction::commit() + 516
13 QuartzCore 0x00000001895d94bc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
14 CoreFoundation 0x0000000184843c30 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
15 CoreFoundation 0x00000001848419d4 __CFRunLoopDoObservers + 372
16 CoreFoundation 0x0000000184841e04 __CFRunLoopRun + 928
17 CoreFoundation 0x0000000184770dc0 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x000000018f8c4088 GSEventRunModal + 180
19 UIKit 0x0000000189e4af44 UIApplicationMain + 204
20 anAppName 0x0000000100118ef4 main (AppDelegate.swift:19)
21 libdyld.dylib 0x0000000199bbe8b8 start + 4
Thread 1:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x0000000199cdc59c kevent_qos + 8
1 libdispatch.dylib 0x0000000199ba0a04 _dispatch_mgr_invoke + 232
2 libdispatch.dylib 0x0000000199b8f93c _dispatch_source_invoke + 0
Thread 3:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 4:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 5:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x0000000199cc0c30 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000199cc0aac mach_msg + 72
2 CoreFoundation 0x0000000184844168 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000184841e6c __CFRunLoopRun + 1032
4 CoreFoundation 0x0000000184770dc0 CFRunLoopRunSpecific + 384
5 CFNetwork 0x000000018400e074 +[NSURLConnection(Loader) _resourceLoadLoop:] + 412
6 Foundation 0x00000001857cb138 __NSThread__start__ + 1000
7 libsystem_pthread.dylib 0x0000000199da3b3c _pthread_body + 156
8 libsystem_pthread.dylib 0x0000000199da3aa0 _pthread_body + 0
9 libsystem_pthread.dylib 0x0000000199da1030 thread_start + 4
Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x0000000199cdb408 __select + 8
1 CoreFoundation 0x000000018484a6d0 __CFSocketManager + 648
2 libsystem_pthread.dylib 0x0000000199da3b3c _pthread_body + 156
3 libsystem_pthread.dylib 0x0000000199da3aa0 _pthread_body + 0
4 libsystem_pthread.dylib 0x0000000199da1030 thread_start + 4
Thread 8:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 9:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000101315400 x1: 0x0000000199d9a8f4 x2: 0x0000000000000050 x3: 0x0000000199d08674
x4: 0x0000000000000000 x5: 0x0000000000000033 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x0000000101315408 x9: 0x0000000000000005 x10: 0x0000000000000000 x11: 0x0000000000000a00
x12: 0x0000000000000040 x13: 0x0000000000000009 x14: 0x0000000000904810 x15: 0x0000000155a00000
x16: 0x0000000199d08178 x17: 0x00000001001905e0 x18: 0x0000000000000000 x19: 0x00000001548acc00
x20: 0x0000000000000008 x21: 0x0000000000000010 x22: 0x0000000000000000 x23: 0x0000000000000020
x24: 0x0000000000000040 x25: 0x0000000000000200 x26: 0x0000000100458a40 x27: 0x0000000000000420
x28: 0x0000000000000000 fp: 0x000000016fd813f0 lr: 0x00000001000d5f1c
sp: 0x000000016fd81210 pc: 0x00000001000d6b24 cpsr: 0x80000000
Binary Images: ...
和代码
import UIKit
import CoreLocation
let locationsManager = CLLocationManager()
var usersLocation = CLLocation()
var flag : Bool!
class MeetUpsListDisplayTableViewController : UITableViewController,CLLocationManagerDelegate {
var meetUpsJSON = [NSDictionary]()
var userLocation : CLLocation?
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
print("failed with error :\(error)")
locationsManager.stopUpdatingLocation()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
usersLocation = locations.last!
let usersCoordinates = CLGeocoder()
usersCoordinates.reverseGeocodeLocation(usersLocation) { ( placemark : [CLPlacemark]?, error : NSError?) -> Void in
if error == nil {
self.fetchEventsInUsersCountry((placemark?.last?.ISOcountryCode)!)
locationsManager.stopUpdatingLocation()
}else{
print(error)
}
}
locationsManager.stopUpdatingLocation()
}
func fetchEventsInUsersCountry( countryISO : String ){
let components = NSURLComponents()
components.scheme = "https"
components.host = "www.website.com"
components.path = "/TMVUKApp/findEvents.php"
components.query = "usersISOCountryCode=\(countryISO)"
let fetchEventsURL = components.URL!
print(fetchEventsURL)
let request = NSURLRequest(URL: fetchEventsURL)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request) {
(data, response, error) -> Void in
if error == nil{
self.meetUpsJSON = try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableLeaves) as! [NSDictionary]
dispatch_async(dispatch_get_main_queue()) {
if self.meetUpsJSON.count > 0 {
self.tableView.reloadData()
}
}
}
}
task.resume()
}
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerNib(UINib(nibName: "MeetUpDisplayTableViewCell", bundle: nil), forCellReuseIdentifier: "meetUp")
navigationController?.hidesBarsOnSwipe = true
tableView.tableFooterView = UIView(frame: CGRectZero)
//************************** GEtting User's latitude/ Longitude ********************
locationsManager.delegate = self
locationsManager.startUpdatingLocation()
//************************** GEtting User's latitude/ Longitude ********************
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print("noris")
return self.meetUpsJSON.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
print("cfraip")
let cell = self.tableView.dequeueReusableCellWithIdentifier("meetUp", forIndexPath: indexPath) as! MeetUpDisplayTableViewCell
//
// ///meetUpsJSON is array of dictionaries.
let JSONDict = meetUpsJSON[indexPath.row]
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.timeZone = NSTimeZone.systemTimeZone()
if let eventDateString = JSONDict["EventDateTime"] as? String {
let eventDate = dateFormatter.dateFromString(eventDateString)
let calendar = NSCalendar.currentCalendar()
let components : NSDateComponents = calendar.components([NSCalendarUnit.Year,NSCalendarUnit.Month,NSCalendarUnit.Day,NSCalendarUnit.Hour,NSCalendarUnit.Minute,NSCalendarUnit.Weekday], fromDate: eventDate!)
cell.lblCalendarDateDisplay.text = "\(components.day)"
var dayOfWeek : String?
var monthOfYear : String?
switch (components.weekday){
case 1:
dayOfWeek = "Sun"
case 2:
dayOfWeek = "Mon"
case 3:
dayOfWeek = "Tue"
case 4:
dayOfWeek = "Wed"
case 5:
dayOfWeek = "Thu"
case 6:
dayOfWeek = "Fri"
case 7:
dayOfWeek = "Sat"
default:
print("hit deafult")
}
switch (components.month){
case 1:
monthOfYear = "Jan"
case 2:
monthOfYear = "Feb"
case 3:
monthOfYear = "Mar"
case 4:
monthOfYear = "Apr"
case 5:
monthOfYear = "May"
case 6:
monthOfYear = "Jun"
case 7:
monthOfYear = "Jul"
case 8:
monthOfYear = "Aug"
case 9:
monthOfYear = "Sep"
case 10:
monthOfYear = "Oct"
case 11:
monthOfYear = "Nov"
case 12:
monthOfYear = "Dec"
default:
print("hit default")
}
cell.lblCalendarDayDisplay.text = dayOfWeek!
cell.lblCalendarMonthYearDisplay.text = "\(monthOfYear!) '\(components.year % 100)"
}
if let eventName = JSONDict["EventName"] as? String{
cell.lblEventNameDisplay.text = eventName
}
cell.vwCalendarDisplay.layer.borderWidth = 1
cell.vwCalendarDisplay.layer.borderColor = UIColor.blackColor().CGColor
if let eventTown = JSONDict["EventTown"] as? String{
cell.lblEventStatusDisplay.text = eventTown //?? ""
}
let userLocation = CLLocation(latitude: usersLocation.coordinate.latitude, longitude: usersLocation.coordinate.longitude)
let eventLocation = CLLocation(latitude: (JSONDict["EventLattitudeCoordinate"] as! NSString).doubleValue, longitude: (JSONDict["EventLongitudeCoordinate"] as! NSString).doubleValue)
let usersDistanceToEventInMeters = userLocation.distanceFromLocation(eventLocation)
let usersDistanceToEventInMiles = usersDistanceToEventInMeters * 0.000621371192
/// let usersDistanceToEventInKiloMeters = usersDistanceToEventInMeters / 1000
cell.lblEventDistanceDisplay.text = Int(usersDistanceToEventInMiles).description
return cell
}
崩溃报告指示的行是
let cell = self.tableView.dequeueReusableCellWithIdentifier("meetUp",
forIndexPath: indexPath) as! MeetUpDisplayTableViewCell
你能从这个崩溃日志中看出原因吗?
"specialised" 是什么意思?
非常感谢您的帮助
如果您必须否决这个问题。干得好你。但请勇敢地说出原因
更新:
所以我安装了 fabrics crashlytics 并在我的日志中添加代码以找出我崩溃的确切位置。从日志看来,我一尝试设置单元格的 属性 就崩溃了。尽管如前所述,这只是一个用户的问题。有什么建议么?非常感谢
已解决:
在使用 Fabrics Crashlytics 并逐行执行后,我发现该应用程序在此处崩溃
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
//changed this
//dateFormatter.timeZone = NSTimeZone.systemTimeZone()
//to
dateFormatter.locale = Locale(localeIdentifier: "en_GB")
if let eventDateString = JSONDict["EventDateTime"] as? String {
let eventDate = dateFormatter.dateFromString(eventDateString)
let calendar = NSCalendar.currentCalendar()
let components : NSDateComponents = calendar.components([NSCalendarUnit.Year,NSCalendarUnit.Month,NSCalendarUnit.Day,NSCalendarUnit.Hour,NSCalendarUnit.Minute,NSCalendarUnit.Weekday], fromDate: eventDate!)
长话短说,当用户设备使用 12 小时制而不是 24 小时制时会发生崩溃。
只有我的一位测试飞行 Beta 测试员报告了一次坠机事件。两个月以来,我一直在摸不着头脑,为什么它会为他们而不是其他人崩溃。我无法自己重现崩溃,因此必须通过带有 iTunes 连接的试飞系统提交新版本,并等待用户对其进行测试,然后我才能知道我是否取得了进展。这是一个非常缓慢和乏味的过程,所以我在这里恳求你的知识,并帮助我首先理解为什么应用程序只为这个用户(共 12 个)崩溃。
我从试飞中得到的坠机报告是
> Incident Identifier: 64F2AB18-E3F4-48A2-A865-CCAB2FF2BF12
Beta Identifier: 5E64ED31-B493-4406-94E5-E4233A84D2A6
Hardware Model: iPhone6,2
Process: anAppName [2491]
Path: /private/var/mobile/Containers/Bundle/Application/0C971485-F0ED-4CA0-96F7-AF9EA7A71A30/anAppName.app/anAppName
Identifier: com.aCleverName.anAppName
Version: 1.0.9.8.1 (1.0)
Beta: YES
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-10-16 11:39:04.04 +0100
Launch Time: 2015-10-16 11:38:54.54 +0100
OS Version: iOS 9.0.2 (13A452)
Report Version: 105
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001000d6b24
Triggered by Thread: 0
Global Trace Buffer (reverse chronological seconds):
0.467279 CFNetwork 0x0000000183f919a4 TCP Conn 0x1545fb500 SSL Handshake DONE
0.722080 CFNetwork 0x0000000183f918b4 TCP Conn 0x1545fb500 starting SSL negotiation
0.722520 CFNetwork 0x0000000184033760 TCP Conn 0x1545fb500 complete. fd: 7, err: 0
0.723794 CFNetwork 0x0000000184034c8c TCP Conn 0x1545fb500 event 1. err: 0
0.761090 CFNetwork 0x0000000184034d64 TCP Conn 0x1545fb500 started
0.764039 CFNetwork 0x000000018408a5a4 Creating default cookie storage with default identifier
0.764039 CFNetwork 0x000000018408a570 Faulting in CFHTTPCookieStorage singleton
0.764039 CFNetwork 0x00000001840dc498 Faulting in NSHTTPCookieStorage singleton
6.422985 AppleJPEG 0x000000018bb02348 [0x1550bb000] Created session
6.435154 AppleJPEG 0x000000018bb02348 [0x15487f600] Created session
6.480890 AppleJPEG 0x000000018bb02348 [0x1550c1000] Created session
6.952666 CFNetwork 0x0000000183f919a4 TCP Conn 0x1546a5230 SSL Handshake DONE
7.034320 CFNetwork 0x0000000183f918b4 TCP Conn 0x1546a5230 starting SSL negotiation
7.035121 CFNetwork 0x0000000184033760 TCP Conn 0x1546a5230 complete. fd: 6, err: 0
7.036622 CFNetwork 0x0000000184034c8c TCP Conn 0x1546a5230 event 1. err: 0
7.607332 CFNetwork 0x0000000184034d64 TCP Conn 0x1546a5230 started
7.726344 CFNetwork 0x0000000183f919a4 TCP Conn 0x154670e50 SSL Handshake DONE
7.868298 CFNetwork 0x0000000183f919a4 TCP Conn 0x1546408d0 SSL Handshake DONE
7.877690 CFNetwork 0x0000000183f918b4 TCP Conn 0x154670e50 starting SSL negotiation
7.878310 CFNetwork 0x0000000184033760 TCP Conn 0x154670e50 complete. fd: 7, err: 0
7.879900 CFNetwork 0x0000000184034c8c TCP Conn 0x154670e50 event 1. err: 0
7.979690 CFNetwork 0x0000000183f918b4 TCP Conn 0x1546408d0 starting SSL negotiation
7.981042 CFNetwork 0x0000000184033760 TCP Conn 0x1546408d0 complete. fd: 6, err: 0
7.982874 CFNetwork 0x0000000184034c8c TCP Conn 0x1546408d0 event 1. err: 0
8.939527 CFNetwork 0x0000000184034d64 TCP Conn 0x154670e50 started
9.065458 CFNetwork 0x0000000184034d64 TCP Conn 0x1546408d0 started
Thread 0 name:
Thread 0 Crashed:
0 anAppName 0x00000001000d6b24 specialized MeetUpsListDisplayTableViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (MeetUpsListDisplayTableViewController.swift:141)
1 anAppName 0x00000001000d48f0 @objc MeetUpsListDisplayTableViewController.tableView(UITableView, cellForRowAtIndexPath : NSIndexPath) -> UITableViewCell (MeetUpsListDisplayTableViewController.swift:0)
2 UIKit 0x000000018a125660 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 688
3 UIKit 0x000000018a1257b8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
4 UIKit 0x000000018a1153b8 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2440
5 UIKit 0x000000018a12a348 -[UITableView _performWithCachedTraitCollection:] + 104
6 UIKit 0x0000000189ecba74 -[UITableView layoutSubviews] + 176
7 UIKit 0x0000000189ddeff0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 644
8 QuartzCore 0x00000001895e5f14 -[CALayer layoutSublayers] + 148
9 QuartzCore 0x00000001895e0b20 CA::Layer::layout_if_needed(CA::Transaction*) + 292
10 QuartzCore 0x00000001895e09e0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
11 QuartzCore 0x00000001895e007c CA::Context::commit_transaction(CA::Transaction*) + 252
12 QuartzCore 0x00000001895dfdd0 CA::Transaction::commit() + 516
13 QuartzCore 0x00000001895d94bc CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
14 CoreFoundation 0x0000000184843c30 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
15 CoreFoundation 0x00000001848419d4 __CFRunLoopDoObservers + 372
16 CoreFoundation 0x0000000184841e04 __CFRunLoopRun + 928
17 CoreFoundation 0x0000000184770dc0 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x000000018f8c4088 GSEventRunModal + 180
19 UIKit 0x0000000189e4af44 UIApplicationMain + 204
20 anAppName 0x0000000100118ef4 main (AppDelegate.swift:19)
21 libdyld.dylib 0x0000000199bbe8b8 start + 4
Thread 1:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x0000000199cdc59c kevent_qos + 8
1 libdispatch.dylib 0x0000000199ba0a04 _dispatch_mgr_invoke + 232
2 libdispatch.dylib 0x0000000199b8f93c _dispatch_source_invoke + 0
Thread 3:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 4:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 5:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x0000000199cc0c30 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000199cc0aac mach_msg + 72
2 CoreFoundation 0x0000000184844168 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000184841e6c __CFRunLoopRun + 1032
4 CoreFoundation 0x0000000184770dc0 CFRunLoopRunSpecific + 384
5 CFNetwork 0x000000018400e074 +[NSURLConnection(Loader) _resourceLoadLoop:] + 412
6 Foundation 0x00000001857cb138 __NSThread__start__ + 1000
7 libsystem_pthread.dylib 0x0000000199da3b3c _pthread_body + 156
8 libsystem_pthread.dylib 0x0000000199da3aa0 _pthread_body + 0
9 libsystem_pthread.dylib 0x0000000199da1030 thread_start + 4
Thread 7 name:
Thread 7:
0 libsystem_kernel.dylib 0x0000000199cdb408 __select + 8
1 CoreFoundation 0x000000018484a6d0 __CFSocketManager + 648
2 libsystem_pthread.dylib 0x0000000199da3b3c _pthread_body + 156
3 libsystem_pthread.dylib 0x0000000199da3aa0 _pthread_body + 0
4 libsystem_pthread.dylib 0x0000000199da1030 thread_start + 4
Thread 8:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 9:
0 libsystem_kernel.dylib 0x0000000199cdbc0c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000199da1538 _pthread_wqthread + 1284
2 libsystem_pthread.dylib 0x0000000199da1028 start_wqthread + 4
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000101315400 x1: 0x0000000199d9a8f4 x2: 0x0000000000000050 x3: 0x0000000199d08674
x4: 0x0000000000000000 x5: 0x0000000000000033 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x0000000101315408 x9: 0x0000000000000005 x10: 0x0000000000000000 x11: 0x0000000000000a00
x12: 0x0000000000000040 x13: 0x0000000000000009 x14: 0x0000000000904810 x15: 0x0000000155a00000
x16: 0x0000000199d08178 x17: 0x00000001001905e0 x18: 0x0000000000000000 x19: 0x00000001548acc00
x20: 0x0000000000000008 x21: 0x0000000000000010 x22: 0x0000000000000000 x23: 0x0000000000000020
x24: 0x0000000000000040 x25: 0x0000000000000200 x26: 0x0000000100458a40 x27: 0x0000000000000420
x28: 0x0000000000000000 fp: 0x000000016fd813f0 lr: 0x00000001000d5f1c
sp: 0x000000016fd81210 pc: 0x00000001000d6b24 cpsr: 0x80000000
Binary Images: ...
和代码
import UIKit
import CoreLocation
let locationsManager = CLLocationManager()
var usersLocation = CLLocation()
var flag : Bool!
class MeetUpsListDisplayTableViewController : UITableViewController,CLLocationManagerDelegate {
var meetUpsJSON = [NSDictionary]()
var userLocation : CLLocation?
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
print("failed with error :\(error)")
locationsManager.stopUpdatingLocation()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
usersLocation = locations.last!
let usersCoordinates = CLGeocoder()
usersCoordinates.reverseGeocodeLocation(usersLocation) { ( placemark : [CLPlacemark]?, error : NSError?) -> Void in
if error == nil {
self.fetchEventsInUsersCountry((placemark?.last?.ISOcountryCode)!)
locationsManager.stopUpdatingLocation()
}else{
print(error)
}
}
locationsManager.stopUpdatingLocation()
}
func fetchEventsInUsersCountry( countryISO : String ){
let components = NSURLComponents()
components.scheme = "https"
components.host = "www.website.com"
components.path = "/TMVUKApp/findEvents.php"
components.query = "usersISOCountryCode=\(countryISO)"
let fetchEventsURL = components.URL!
print(fetchEventsURL)
let request = NSURLRequest(URL: fetchEventsURL)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request) {
(data, response, error) -> Void in
if error == nil{
self.meetUpsJSON = try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableLeaves) as! [NSDictionary]
dispatch_async(dispatch_get_main_queue()) {
if self.meetUpsJSON.count > 0 {
self.tableView.reloadData()
}
}
}
}
task.resume()
}
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerNib(UINib(nibName: "MeetUpDisplayTableViewCell", bundle: nil), forCellReuseIdentifier: "meetUp")
navigationController?.hidesBarsOnSwipe = true
tableView.tableFooterView = UIView(frame: CGRectZero)
//************************** GEtting User's latitude/ Longitude ********************
locationsManager.delegate = self
locationsManager.startUpdatingLocation()
//************************** GEtting User's latitude/ Longitude ********************
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print("noris")
return self.meetUpsJSON.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
print("cfraip")
let cell = self.tableView.dequeueReusableCellWithIdentifier("meetUp", forIndexPath: indexPath) as! MeetUpDisplayTableViewCell
//
// ///meetUpsJSON is array of dictionaries.
let JSONDict = meetUpsJSON[indexPath.row]
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.timeZone = NSTimeZone.systemTimeZone()
if let eventDateString = JSONDict["EventDateTime"] as? String {
let eventDate = dateFormatter.dateFromString(eventDateString)
let calendar = NSCalendar.currentCalendar()
let components : NSDateComponents = calendar.components([NSCalendarUnit.Year,NSCalendarUnit.Month,NSCalendarUnit.Day,NSCalendarUnit.Hour,NSCalendarUnit.Minute,NSCalendarUnit.Weekday], fromDate: eventDate!)
cell.lblCalendarDateDisplay.text = "\(components.day)"
var dayOfWeek : String?
var monthOfYear : String?
switch (components.weekday){
case 1:
dayOfWeek = "Sun"
case 2:
dayOfWeek = "Mon"
case 3:
dayOfWeek = "Tue"
case 4:
dayOfWeek = "Wed"
case 5:
dayOfWeek = "Thu"
case 6:
dayOfWeek = "Fri"
case 7:
dayOfWeek = "Sat"
default:
print("hit deafult")
}
switch (components.month){
case 1:
monthOfYear = "Jan"
case 2:
monthOfYear = "Feb"
case 3:
monthOfYear = "Mar"
case 4:
monthOfYear = "Apr"
case 5:
monthOfYear = "May"
case 6:
monthOfYear = "Jun"
case 7:
monthOfYear = "Jul"
case 8:
monthOfYear = "Aug"
case 9:
monthOfYear = "Sep"
case 10:
monthOfYear = "Oct"
case 11:
monthOfYear = "Nov"
case 12:
monthOfYear = "Dec"
default:
print("hit default")
}
cell.lblCalendarDayDisplay.text = dayOfWeek!
cell.lblCalendarMonthYearDisplay.text = "\(monthOfYear!) '\(components.year % 100)"
}
if let eventName = JSONDict["EventName"] as? String{
cell.lblEventNameDisplay.text = eventName
}
cell.vwCalendarDisplay.layer.borderWidth = 1
cell.vwCalendarDisplay.layer.borderColor = UIColor.blackColor().CGColor
if let eventTown = JSONDict["EventTown"] as? String{
cell.lblEventStatusDisplay.text = eventTown //?? ""
}
let userLocation = CLLocation(latitude: usersLocation.coordinate.latitude, longitude: usersLocation.coordinate.longitude)
let eventLocation = CLLocation(latitude: (JSONDict["EventLattitudeCoordinate"] as! NSString).doubleValue, longitude: (JSONDict["EventLongitudeCoordinate"] as! NSString).doubleValue)
let usersDistanceToEventInMeters = userLocation.distanceFromLocation(eventLocation)
let usersDistanceToEventInMiles = usersDistanceToEventInMeters * 0.000621371192
/// let usersDistanceToEventInKiloMeters = usersDistanceToEventInMeters / 1000
cell.lblEventDistanceDisplay.text = Int(usersDistanceToEventInMiles).description
return cell
}
崩溃报告指示的行是
let cell = self.tableView.dequeueReusableCellWithIdentifier("meetUp", forIndexPath: indexPath) as! MeetUpDisplayTableViewCell
你能从这个崩溃日志中看出原因吗? "specialised" 是什么意思?
非常感谢您的帮助
如果您必须否决这个问题。干得好你。但请勇敢地说出原因
更新: 所以我安装了 fabrics crashlytics 并在我的日志中添加代码以找出我崩溃的确切位置。从日志看来,我一尝试设置单元格的 属性 就崩溃了。尽管如前所述,这只是一个用户的问题。有什么建议么?非常感谢
已解决:
在使用 Fabrics Crashlytics 并逐行执行后,我发现该应用程序在此处崩溃
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
//changed this
//dateFormatter.timeZone = NSTimeZone.systemTimeZone()
//to
dateFormatter.locale = Locale(localeIdentifier: "en_GB")
if let eventDateString = JSONDict["EventDateTime"] as? String {
let eventDate = dateFormatter.dateFromString(eventDateString)
let calendar = NSCalendar.currentCalendar()
let components : NSDateComponents = calendar.components([NSCalendarUnit.Year,NSCalendarUnit.Month,NSCalendarUnit.Day,NSCalendarUnit.Hour,NSCalendarUnit.Minute,NSCalendarUnit.Weekday], fromDate: eventDate!)
长话短说,当用户设备使用 12 小时制而不是 24 小时制时会发生崩溃。