简体   繁体   中英

IOS App Crash's only in Release mode?

My IOS app work with no issues in the debug mode , its has been rejected by apple review team (IPV6 connection ....etc) after submitting i have generate .ipa file for the release mode to test if my app has a real crash issue and i found that its really crashing as they mentioned .

note : the crash issue is not caused by the IPV6 because its crashing on the IPV4 as well

first i want to know why this crash doesn't occurred on the debug mode ?? and secondly after digging for 2 days until now i didn't figure out what is the main cause of my app crash issue ??

this is my code :

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){}


        })
    }
}

and the crash report :

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

Update i have only change the loaddata function to

 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)")
        }

and the crash report changes as below !!

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

any ideas will be much appreciated

Check for different settings between debug and release. Check what happens if you turn off optimisations, that also lets you debug your code. Check if you have logging statements or asserts that fix your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM