gpt4 book ai didi

IOS 应用程序崩溃仅在 Release模式下发生?

转载 作者:行者123 更新时间:2023-11-30 12:58:17 26 4
gpt4 key购买 nike

我的 IOS 应用程序在 Debug模式下工作没有问题,提交后已被苹果审核团队拒绝(IPV6 连接...等),我已经为 Release模式生成了 .ipa 文件来测试我的应用程序是否有一个真正的崩溃问题,我发现它确实像他们提到的那样崩溃了。

注意:崩溃问题不是由 IPV6 引起的,因为它也会在 IPV4 上崩溃

首先我想知道为什么在 Debug模式下不会发生此崩溃?其次,经过两天的挖掘,到现在我还没弄清楚我的应用程序崩溃问题的主要原因是什么??

这是我的代码:

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

任何想法将不胜感激

最佳答案

检查调试和发布之间的不同设置。检查如果关闭优化会发生什么,这也可以让您调试代码。检查您是否有可以修复代码的日志记录语句或断言。

关于IOS 应用程序崩溃仅在 Release模式下发生?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40160379/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com