iOS应用程序仅在TestFlight构建时崩溃

时间:2017-06-05 13:12:08

标签: ios iphone swift xcode swift3

我在Swift中有一个ios应用程序。应用程序运行良好,并且从xcode本地上传时不会崩溃。但是从testflight上传时,应用程序崩溃了。 我发现代码没有错。 我已在我的应用程序中实现了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

我对此报告中的任何内容都不了解,如果有人知道,请帮帮我。

这是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.
}

这是viewWillAppear

 override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    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"]

}

1 个答案:

答案 0 :(得分:0)

我认为查看var yScale = d3.scaleLinear() .domain([10, 1200]) .range([0, 500]); console.log(yScale(1200)); console.log(d3.version); 的一些代码会让我们更深入了解。

但是这里有一些评论:

  • 不确定完整堆栈,但由于某种原因,在HomeViewController之前调用viewWillAppear似乎很奇怪。您是否正确地使用相应的方法调用viewDidLoad
  • 您是否尝试使用处于发布模式和调试模式的仪器来分析应用程序?您可以在架构设置上进行管理。
  • 另一个暗示,但我觉得它对你的场景有点高级,是优化级别。转到目标设置并搜索super,您会发现它与调试和发布不同。有时,具有多个块和/或线程的复杂算法可能会受此影响。

主页帮助