【发布时间】:2016-10-20 17:03:25
【问题描述】:
我的 IOS 应用程序在调试模式下正常工作,提交后被苹果审核团队(IPV6 连接 ....etc)拒绝我已经为发布模式生成 .ipa 文件以测试我的应用程序是否有一个真正的崩溃问题,我发现它真的像他们提到的那样崩溃。
注意:崩溃问题不是由 IPV6 引起的,因为它在 IPV4 上也会崩溃
首先我想知道为什么在调试模式下没有发生这种崩溃?? 其次,在挖掘了 2 天之后,直到现在我还没有弄清楚我的应用程序崩溃问题的主要原因是什么??
这是我的代码:
import UIKit
import SDWebImage
class Codingtbl: UITableViewController {
@IBOutlet var imgtbl: UITableView!
var imgarray = [Images]()
let backendless = Backendless()
override func viewDidLoad() {
super.viewDidLoad()
imgtbl.delegate=self
imgtbl.dataSource=self
}
override func viewDidAppear(_ animated: Bool) {
loaddatawithquery()
}
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return imgarray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = self.imgtbl.dequeueReusableCell(withIdentifier: "csmcell") as! csmcell{
let imgurl = URL(string : self.imgarray [(indexPath as NSIndexPath).row].imgurl!)
cell.imgiv.sd_setImage(with: imgurl)
return cell
}else{
let cell = csmcell()
let imgurl = URL(string : self.imgarray [(indexPath as NSIndexPath).row].imgurl!)
cell.imgiv.sd_setImage(with: imgurl)
return cell
}
}
func loaddatawithquery(){
let whereClause = "catogary ='telecom'"
let dataQuery = BackendlessDataQuery()
dataQuery.queryOptions.pageSize=50
dataQuery.whereClause = whereClause
backendless.data.of(Images.ofClass()).find(dataQuery,response: {(result: BackendlessCollection?) -> Void in
let data = result?.getCurrentPage() as! [Images]
for obj in data {
self.imgarray.append(obj)
}
self.imgtbl.reloadData()
},
error: { (fault: Fault?) -> Void in
let alert = UIAlertController(title: "info", message:"Please connect to the internet", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in
let viewController = self.storyboard?.instantiateViewController(withIdentifier: "mainmenu") as! Main_Menu
self.navigationController?.pushViewController(viewController, animated: true)
})
self.present(alert, animated: true){}
})
}
}
和崩溃报告:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018d83a014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018d901460 pthread_kill + 112
2 libsystem_c.dylib 0x000000018d7ae3f4 abort + 140
3 libswiftCore.dylib 0x00000001004e7570 swift_deletedMethodError (__hidden#17462_:282)
4 libswiftCore.dylib 0x00000001004ccfdc _hidden#16819_ (__hidden#16861_:392)
5 libswiftCore.dylib 0x00000001004cd06c swift_dynamicCastClass (__hidden#16861_:478)
6 libswiftCore.dylib 0x00000001004cdbd0 swift_dynamicCastUnknownClassUnconditional (__hidden#16793_:49)
7 libswiftCore.dylib 0x00000001004d00a4 _hidden#16825_ (__hidden#16861_:1637)
8 libswiftCore.dylib 0x00000001004cec6c swift_dynamicCast (__hidden#16861_:1676)
9 libswiftCore.dylib 0x00000001004cefb8 swift_dynamicCast (__hidden#16861_:1684)
10 Horizon Wave 0x00000001000ca15c _hidden#659_ (__hidden#722_:0)
11 Horizon Wave 0x00000001000caaf8 _hidden#664_ (__hidden#722_:0)
12 Horizon Wave 0x00000001000cafb4 _hidden#667_ (__hidden#722_:0)
13 Horizon Wave 0x00000001000cb868 _hidden#672_ (__hidden#722_:0)
14 Horizon Wave 0x00000001000f88c4 _hidden#3021_ (__hidden#3052_:302)
15 Horizon Wave 0x00000001000f8364 _hidden#3011_ (__hidden#3052_:208)
16 Horizon Wave 0x00000001000f8388 _hidden#3011_ (__hidden#3052_:214)
17 Horizon Wave 0x00000001000cdbb4 _hidden#1017_ (__hidden#1060_:290)
18 libdispatch.dylib 0x000000018d6f5200 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x000000018d6f51c0 _dispatch_client_callout + 16
20 libdispatch.dylib 0x000000018d6f9d6c _dispatch_main_queue_callback_4CF + 1000
21 CoreFoundation 0x000000018e819f2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
22 CoreFoundation 0x000000018e817b18 __CFRunLoopRun + 1660
23 CoreFoundation 0x000000018e746048 CFRunLoopRunSpecific + 444
24 GraphicsServices 0x00000001901c9198 GSEventRunModal + 180
25 UIKit 0x0000000194720628 -[UIApplication _run] + 684
26 UIKit 0x000000019471b360 UIApplicationMain + 208
27 Horizon Wave 0x00000001000c4768 main (__hidden#180_:12)
28 libdyld.dylib 0x000000018d7285b8 start + 4
更新我只将 loaddata 函数更改为
func loaddata2() {
let whereClause = "catogary ='telecom'"
let dataQuery = BackendlessDataQuery()
dataQuery.whereClause = whereClause
var error: Fault?
let bc = Backendless.sharedInstance().data.of(Images.ofClass()).find(dataQuery, fault: &error)
if error == nil {
for obj in bc?.data as! [Images]{
imgarray.append(obj)
print("%%%%%%%%%%%%%%%%%%%\(obj.imgurl!)")
}
self.imgtbl.reloadData()
}
else {
print("Server reported an error: \(error)")
}
崩溃报告如下变化!!
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018d83a014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018d901460 pthread_kill + 112
2 libsystem_c.dylib 0x000000018d7ae3f4 abort + 140
3 libswiftCore.dylib 0x000000010045b570 swift_deletedMethodError (__hidden#17462_:282)
4 libswiftCore.dylib 0x0000000100440fdc _hidden#16819_ (__hidden#16861_:392)
5 libswiftCore.dylib 0x000000010044106c swift_dynamicCastClass (__hidden#16861_:478)
6 libswiftCore.dylib 0x0000000100441bd0 swift_dynamicCastUnknownClassUnconditional (__hidden#16793_:49)
7 libswiftCore.dylib 0x00000001004440a4 _hidden#16825_ (__hidden#16861_:1637)
8 libswiftCore.dylib 0x0000000100442c6c swift_dynamicCast (__hidden#16861_:1676)
9 libswiftCore.dylib 0x0000000100442fb8 swift_dynamicCast (__hidden#16861_:1684)
10 Horizon Wave 0x00000001000be1d0 _hidden#661_ (__hidden#728_:0)
11 Horizon Wave 0x00000001000be5fc _hidden#664_ (__hidden#728_:0)
12 Horizon Wave 0x00000001000bd084 _hidden#636_ (__hidden#728_:0)
13 Horizon Wave 0x00000001000bc704 _hidden#625_ (__hidden#728_:0)
14 UIKit 0x00000001946cd2f0 -[UIViewController _setViewAppearState:isAnimating:] + 848
15 UIKit 0x00000001946cd854 -[UIViewController _endAppearanceTransition:] + 220
16 UIKit 0x0000000194785e48 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 1236
17 UIKit 0x0000000194856fa8 __49-[UINavigationController _startCustomTransition:]_block_invoke + 232
18 UIKit 0x00000001947dcad4 -[_UIViewControllerTransitionContext completeTransition:] + 116
19 UIKit 0x000000019492cffc __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke.97 + 712
20 UIKit 0x00000001946ee024 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 492
21 UIKit 0x00000001946edb48 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312
22 UIKit 0x00000001946ed988 -[UIViewAnimationState animationDidStop:finished:] + 160
23 QuartzCore 0x0000000191b76404 CA::Layer::run_animation_callbacks(void*) + 260
24 libdispatch.dylib 0x000000018d6f51c0 _dispatch_client_callout + 16
25 libdispatch.dylib 0x000000018d6f9d6c _dispatch_main_queue_callback_4CF + 1000
26 CoreFoundation 0x000000018e819f2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
27 CoreFoundation 0x000000018e817b18 __CFRunLoopRun + 1660
28 CoreFoundation 0x000000018e746048 CFRunLoopRunSpecific + 444
29 GraphicsServices 0x00000001901c9198 GSEventRunModal + 180
30 UIKit 0x0000000194720628 -[UIApplication _run] + 684
31 UIKit 0x000000019471b360 UIApplicationMain + 208
32 Horizon Wave 0x00000001000b7e84 main (__hidden#180_:12)
33 libdyld.dylib 0x000000018d7285b8 start + 4
任何想法将不胜感激
【问题讨论】:
-
您需要符号化崩溃日志,但看起来强制向下转换失败并且代码处于关闭状态。
let data = result?.getCurrentPage() as! [Images]看起来像是该问题的候选者。 -
@Paulw11 请问你能解释更多吗?如果你候选人这条线你可以建议任何事情,所以我可以检查
-
好吧,如果
result.getCurrentPage()没有返回一个图像数组,你的应用就会崩溃。你应该防御性地编码;使用if let data = result?.getCurrentPage() as? [Images]并处理未检索到数据或不是图像数组的情况 -
@Paulw11 好的,我会检查并反馈
-
@Paulw11 我已经尝试过您的解决方案,但效果不佳,我已更新问题请您再次检查
标签: ios swift crash crash-reports