简体   繁体   English

iOS应用仅在TestFlight构建时崩溃

[英]iOS app is only crashing on TestFlight build

I have an ios app in Swift.The app runs fine and does not crash when uploaded locally from xcode. 我在Swift中有一个ios应用程序,该应用程序运行良好,从xcode本地上传时不会崩溃。 But the app is crashing when uploaded from testflight. 但是从testflight上传时,应用程序崩溃了。 I found that there is nothing wrong in code. 我发现代码没有错。 I have implemented Crashlytics in my app, it has given following report. 我已经在我的应用程序中实现了Crashlytics,它给出了以下报告。

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000100160fe4

Crashed: com.apple.main-thread
0  App                     0x100160fe4 HomeViewController.viewDidLoad() -> () (HomeViewController.swift:57)

1  App                     0x100161014 @objc HomeViewController.viewDidLoad() -> () (HomeViewController.swift)

2  UIKit                          0x18c373ec0 -[UIViewController loadViewIfRequired] + 1036

3  UIKit                          0x18c38b94c -[UIViewController __viewWillAppear:] + 132

4  UIKit                          0x18c5101d4 -[UINavigationController _startCustomTransition:] + 1144

5  UIKit                          0x18c42ab78 -[UINavigationController _startDeferredTransitionIfNeeded:] + 676

6  UIKit                          0x18c42a7e0 -[UINavigationController __viewWillLayoutSubviews] + 64

7  UIKit                          0x18c42a744 -[UILayoutContainerView layoutSubviews] + 188

8  UIKit                          0x18c37107c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200

9  QuartzCore                     0x189561274 -[CALayer layoutSublayers] + 148

10 QuartzCore                     0x189555de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292

11 QuartzCore                     0x189555ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32

12 QuartzCore                     0x1894d134c CA::Context::commit_transaction(CA::Transaction*) + 252

13 QuartzCore                     0x1894f83ac CA::Transaction::commit() + 504
14 QuartzCore                     0x1894f8e78 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120

15 CoreFoundation                 0x1861f09a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32

16 CoreFoundation                 0x1861ee630 __CFRunLoopDoObservers + 372

17 CoreFoundation                 0x1861eea7c __CFRunLoopRun + 956

18 CoreFoundation                 0x18611eda4 CFRunLoopRunSpecific + 424

19 GraphicsServices               0x187b88074 GSEventRunModal + 100

20 UIKit                          0x18c3d9058 UIApplicationMain + 208

21 App                     0x1000d8688 main (NewProductData.swift:18)

22 libdyld.dylib                  0x18512d59c start + 4

I am not understanding anything from this reports, please help me out if anyone knows. 我对这份报告一无所知,如果有人知道,请帮助我。

Here is viewDidload 这是viewDidload

  override func viewDidLoad() {
    super.viewDidLoad()
     Giving instance of HomeViewController to AppDelegate
      let appDele = UIApplication.shared.delegate as! AppDelegate
      appDele.homeVC = self
    token = FIRInstanceID.instanceID().token()!
//Method to handle Firebase token  
    UserDefaults.standard.set(token, forKey: "Notificationtoken")
    print("@@@@@@@@@@@@@@@@@@@@@@@ token provided is \(String(describing: token))")
     let tokenstr = UserDefaults.standard.value(forKey: "Notificationtoken") as! String
    if(token == tokenstr){
        handleFCMToken(token: tokenstr)
    }
    else{
        handleFCMToken(token: token!)

    }

    setUpNavBar()
    setPopUpImage()
    setUpcarousel()
    setUpDelegates()
    let help = Helper()

    help.setUpGoogleAnalytics(screenName: "Home")

    self.presenter = HomeViewPresenter(homeView: self)
    presenter.getCarousel()
    if(showProfile){
        ProfileClicked()
    }
    // Do any additional setup after loading the view.
}

And here is viewWillAppear 这是viewWillAppear

 override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    setUpUI()


}

and method of setupUI 和setupUI的方法

 func setUpUI(){
    let wholesaler:Wholesaler = Helper.getWsProfile()

    DispatchQueue.main.async {
        self.wholesalerName.text = "Hello, \(wholesaler.wholesaler_name)"
        self.pdsPoints.text = "\(wholesaler.pdsPoints!)"
        self.visibilityPoints.text = "\(wholesaler.visibilityPoins!)"
    }
    iconNameString = ["SMS","Customer\n Groups","Visibility\n Contest","My\n Earnings","\(wholesaler.lastSchemeMonth!)\n Schemes","App\n News", "", "Contact\n Us"]

}

I think that viewing some code of your HomeViewController will give us more insight. 我认为查看HomeViewController一些代码将使我们有更多的了解。

But here some comments: 但是这里有一些评论:

  • Not sure about the full stack, but its seems weird that viewWillAppear is being called before viewDidLoad for some reason. 不确定完整堆栈,但是由于某种原因在viewDidLoad之前调用viewWillAppear似乎很奇怪。 Are you calling super correctly on those corresponding methods? 您是否在这些相应方法上正确调用了super
  • Have you try profiling the app using instruments in release mode vs debug mode? 您是否尝试过使用发布模式和调试模式的工具对应用程序进行性能分析? You can manage this on your schema settings. 您可以在架构设置中进行管理。
  • Another hint, but I think it kind of advanced for your scenario, is the optimization level. 另一个提示是优化级别,但这对您的情况而言是一种高级提示。 Go to your target settings and search for Optimization Level , you'll notice it is different for debug and release. 转到目标设置并搜索“ Optimization Level ,您会发现调试和发行版有所不同。 Sometimes complex algorithms with multiple blocks and/or threads may be affected by this. 有时,具有多个块和/或线程的复杂算法可能会受到此影响。

Home it helps 家有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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