应用审查小组的 EXC_BREAKPOINT (SIGTRAP)。不可重现

Posted

技术标签:

【中文标题】应用审查小组的 EXC_BREAKPOINT (SIGTRAP)。不可重现【英文标题】:EXC_BREAKPOINT (SIGTRAP) for App Review Team. Not Reproducible 【发布时间】:2016-09-01 00:00:33 【问题描述】:

因此,我的应用(ios、Swift 2.2、Xcode 7.3)被 Beta App Review 团队拒绝,因为它在发布时崩溃了。

更新得到了应用审查小组的答复...它只是在 iPad 上崩溃,而不是在 iPhone 上。

问题是我无法重现这次崩溃。即使在我的 3 台物理设备(iPhone 4S、iPhone6 和 iPad Air)上进行全新安装或通过 TestFlight 内部测试进行更新(因此与 App Review Team 正在审查的构建和存档完全相同)时,也不行

崩溃日志摘录(从 App Review Team 收到)(符号):

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010032ced8
Triggered by Thread:  0
Filtered syslog:
None found
Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   AppName                       0x000000010032ced8 MapViewController.viewDidLoad() -> () (MapViewController.swift:210)
1   AppName                       0x000000010032cf2c @objc MapViewController.viewDidLoad() -> () (MapViewController.swift:0)
2   UIKit                         0x0000000187394b40 -[UIViewController loadViewIfRequired] + 996

MapViewController 是 UINavigationController 的 rootViewController,第 210 行包含:self.view.backgroundColor = UIColor.blackColor()

更新: 删除该行并提交另一个构建。相同的崩溃日志,现在崩溃在下一行:imageview.hidden = true

尝试直接从我的设备上的 Xcode 运行“发布”配置,希望它会崩溃并为我指明正确的方向,但是,没有崩溃 :-/ 此外,非常有趣的是,我在同一个应用程序的先前版本中也有同样的情况(也被拒绝了)。我向审查团队发送了与这个故事类似的回复,他们批准了它进行外部 beta 测试(没有任何更改)。只有我的一名 Beta 测试人员(总共大约 300 人)在启动时报告了类似的崩溃。

在 Sigtrap 断点上进行了很多谷歌搜索,但没有找到与我所经历的类似的任何东西。所以,我在这里真的很茫然。我无法重现它,崩溃日志也没有指出我可以调查的任何方向。

更新:这是我从 App Review Team 获得的完整(符号化)崩溃报告。 (不包括二进制图像,那里看起来都很好)。也许那里的某些东西(也许是其他线程?)为某人敲响了警钟。任何帮助或建议将不胜感激。

Incident Identifier: 5A47A678-EDD0-400B-873F-4BF466E13218
CrashReporter Key:   31c74ad5c3da4b8205dc32464f9bc6fde2f4edea
Hardware Model:      xxx
Process:             AppName [2081]
Path:                /private/var/containers/Bundle/Application/065CA51D-8981-419B-BEB8-3BD5255073E8/AppName.app/AppName
Identifier:          com.pinguido.scenic
Version:             1 (1.08)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2016-05-06 20:56:49.49 -0700
Launch Time:         2016-05-06 20:56:49.49 -0700
OS Version:          iOS 9.3.1 (13E238)
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010032d7fc
Triggered by Thread:  0

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   AppName                         0x000000010032d7fc MapViewController.viewDidLoad() -> () (MapViewController.swift:216)
1   AppName                         0x000000010032d850 @objc MapViewController.viewDidLoad() -> () (MapViewController.swift:0)
2   UIKit                           0x0000000187520b40 -[UIViewController loadViewIfRequired] + 996
3   UIKit                           0x00000001875e1118 -[UINavigationController _layoutViewController:] + 72
4   UIKit                           0x00000001875e0ff0 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 416
5   UIKit                           0x00000001875e0238 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144
6   UIKit                           0x00000001875dfddc -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
7   UIKit                           0x00000001875dfa04 -[UINavigationController __viewWillLayoutSubviews] + 60
8   UIKit                           0x00000001875df96c -[UILayoutContainerView layoutSubviews] + 208
9   UIKit                           0x000000018751c0e4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
10  QuartzCore                      0x0000000184ec2a28 -[CALayer layoutSublayers] + 148
11  QuartzCore                      0x0000000184ebd634 CA::Layer::layout_if_needed(CA::Transaction*) + 292
12  QuartzCore                      0x0000000184ebd4f4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
13  QuartzCore                      0x0000000184ebcb24 CA::Context::commit_transaction(CA::Transaction*) + 252
14  QuartzCore                      0x0000000184ebc86c CA::Transaction::commit() + 512
15  QuartzCore                      0x0000000184eb5dd8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
16  CoreFoundation                  0x00000001823947b0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
17  CoreFoundation                  0x0000000182392554 __CFRunLoopDoObservers + 372
18  CoreFoundation                  0x00000001822bcd30 CFRunLoopRunSpecific + 416
19  UIKit                           0x000000018758f834 -[UIApplication _run] + 460
20  UIKit                           0x0000000187589f70 UIApplicationMain + 204
21  AppName                         0x000000010042be50 main (AppDelegate.swift:16)
22  libdyld.dylib                   0x0000000181e5a8b8 start + 4

Thread 1:
0   libsystem_kernel.dylib          0x0000000181f78b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000182041530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000182041020 start_wqthread + 4

Thread 2 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0   libsystem_kernel.dylib          0x0000000181f794d8 kevent_qos + 8
1   libdispatch.dylib               0x0000000181e3c7d8 _dispatch_mgr_invoke + 232
2   libdispatch.dylib               0x0000000181e2b648 _dispatch_source_invoke + 0

Thread 3:
0   libsystem_kernel.dylib          0x0000000181f78b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000182041530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000182041020 start_wqthread + 4

Thread 4:
0   libsystem_kernel.dylib          0x0000000181f78b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000182041530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000182041020 start_wqthread + 4

Thread 5:
0   libsystem_kernel.dylib          0x0000000181f7841c __semwait_signal + 8
1   libsystem_c.dylib               0x0000000181e9522c nanosleep + 212
2   libsystem_c.dylib               0x0000000181e9514c usleep + 68
3   AppName                         0x000000010086ac48 recvTimeout + 196
4   AppName                         0x000000010086f864 ConnectionWrapper::recv() + 192
5   AppName                         0x000000010086fed4 HttpUtils::readHttpStatusLine(ConnectionWrapper&, unsigned short&) + 68
6   AppName                         0x000000010086de90 skobbler::HTTP::HttpRequest::receiveAnswerImpl(bool) + 64
7   AppName                         0x000000010086d878 skobbler::HTTP::HttpRequest::receiveAnswer(bool) + 44
8   AppName                         0x000000010086c4ec skobbler::HTTP::HttpManager::HttpWorkerThread::processRequest() + 88
9   AppName                         0x000000010086c938 skobbler::HTTP::HttpManager::HttpWorkerThread::runHelper(void*) + 48
10  libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
11  libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
12  libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 6:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x000000010080b7ec RouteManager::run() + 2588
3   AppName                         0x0000000100807d74 RouteManager::runHelper(void*) + 12
4   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
5   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
6   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 7:
0   libsystem_kernel.dylib          0x0000000181f7841c __semwait_signal + 8
1   libsystem_c.dylib               0x0000000181e9522c nanosleep + 212
2   libsystem_c.dylib               0x0000000181e9514c usleep + 68
3   AppName                         0x000000010086ac48 recvTimeout + 196
4   AppName                         0x000000010086f864 ConnectionWrapper::recv() + 192
5   AppName                         0x000000010086fed4 HttpUtils::readHttpStatusLine(ConnectionWrapper&, unsigned short&) + 68
6   AppName                         0x000000010086de90 skobbler::HTTP::HttpRequest::receiveAnswerImpl(bool) + 64
7   AppName                         0x000000010086d878 skobbler::HTTP::HttpRequest::receiveAnswer(bool) + 44
8   AppName                         0x000000010086c4ec skobbler::HTTP::HttpManager::HttpWorkerThread::processRequest() + 88
9   AppName                         0x000000010086c938 skobbler::HTTP::HttpManager::HttpWorkerThread::runHelper(void*) + 48
10  libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
11  libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
12  libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 8:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042d20 _pthread_cond_wait + 704
2   AppName                         0x00000001007b64e4 SkTimer<MapMatcher, &(MapMatcher::positioningRoutineWrapper(MapMatcher*))>::entryPoint(void*) + 120
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 9:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x00000001006d1354 ThreadWorker::run() + 72
3   AppName                         0x000000010080107c RunInThread::runHelper(void*) + 28
4   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
5   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
6   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 10:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x0000000100622cf0 TileLoader<MapRenderer>::run() + 2512
3   AppName                         0x0000000100770974 TileLoader<MapRenderer>::runHelper(void*) + 12
4   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
5   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
6   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 11:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042d20 _pthread_cond_wait + 704
2   AppName                         0x00000001007748c4 SkTimer<ReRenderTimer, &(ReRenderTimer::reRenderRoutine(ReRenderTimer*))>::entryPoint(void*) + 120
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 12:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042d20 _pthread_cond_wait + 704
2   AppName                         0x00000001007747f0 SkTimer<AnimationTimer, &(AnimationTimer::animationTimerRoutine(AnimationTimer*))>::entryPoint(void*) + 120
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 13:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x00000001006a46c4 WorldTextures::WorkerThreadRoutine(void*) + 100
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 14:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x00000001006aa2ac EarthSphere::WorkerThreadRoutine(void*) + 120
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 15:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042ce8 _pthread_cond_wait + 648
2   AppName                         0x00000001006e2fdc MapSearch::runLoop(void*) + 128
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 16:
0   libsystem_kernel.dylib          0x0000000181f77f24 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x0000000182042d20 _pthread_cond_wait + 704
2   AppName                         0x000000010077fa34 SkTimer<FcdCollector, &(FcdCollector::timerRoutineWrapper(FcdCollector*))>::entryPoint(void*) + 120
3   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
4   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
5   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 17:
0   libsystem_kernel.dylib          0x0000000181f7841c __semwait_signal + 8
1   libsystem_c.dylib               0x0000000181e9522c nanosleep + 212
2   libsystem_c.dylib               0x0000000181efe09c sleep + 44
3   AppName                         0x00000001008010a4 TimerTarget::run() + 20
4   AppName                         0x000000010080107c RunInThread::runHelper(void*) + 28
5   libsystem_pthread.dylib         0x0000000182043b28 _pthread_body + 156
6   libsystem_pthread.dylib         0x0000000182043a8c _pthread_body + 0
7   libsystem_pthread.dylib         0x0000000182041028 thread_start + 4

Thread 18:
0   libsystem_kernel.dylib          0x0000000181f78b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000182041530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000182041020 start_wqthread + 4

Thread 19:
0   libsystem_kernel.dylib          0x0000000181f78b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000182041530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000182041020 start_wqthread + 4

编辑 正如一些人在 cmets 中询问的那样,这里是来自我的 AppDelegate 的 didFinishLaunchingWithOptions 和我的 rootVC 的 viewDidLoad 的代码正如我所提到的,我认为它在我的 viewDidLoad 中没有任何内容,因为它总是在 viewDidLoad 的第一行崩溃。我猜这是我的 AppDel 中的某些东西,或者可能是全局的东西……即在我的 rootVC 的 viewDidLoad 之前执行的东西。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool 
    print("APPDEL: applicationDidFinishLaunching")
    appWasCompletelyClosed = true

    // Set SKMaps API Key & Light Map
    let initSettings: SKMapsInitSettings = SKMapsInitSettings()
    initSettings.mapDetailLevel = SKMapDetailLevel.Light
    initSettings.showConsoleLogs = false
    SKMapsService.sharedInstance().initializeSKMapsWithAPIKey(SKMapsAPIKey, settings: initSettings)

    if UD.appVersion == nil || UD.appVersion != "\(NSBundle.mainBundle().infoDictionary!["CFBundleVersion"]!)" 
        startClean()
        UD.appVersion = "\(NSBundle.mainBundle().infoDictionary!["CFBundleVersion"]!)"
    

    // Get IAP Products & Prices
    IAPHelper.sharedInstance.requestProducts()(success) -> Void in
        if !success 
            printError("Error getting IAP Products")
        
    

    if UD.userID == nil 
        print("First Launch")
        copyCleanDBtoApplicationsFolder()
        MagicalRecord.setupCoreDataStackWithStoreNamed("scenic.sqlite")
        LastSync.resetAll()
        firstLaunch = true
        UD.userID = NSUUID().UUIDString
        print(UD.userID)
        let newUser = User.MR_createEntity()
        newUser.id = UD.userID
        newUser.addedOn = NSDate()
        newUser.lastChanged = NSDate()
        newUser.points = 0
        newUser.pointsToNextLevel = 5
        newUser.level = 0
        newUser.rankWorld = 0
        newUser.rankCountry = 0

        #if DEBUG
            newUser.offlineMapCredits = 100
        #else
            newUser.offlineMapCredits = 5
        #endif


        saveContext()
        self.setUserDefaultsForFirstTime()
        self.createSubDirs()
        Sync.user() (error) -> Void in
            if error 
                print("There was an error creating the new user on the server. Will try again before next sync action.")
            
            else 
                print("User succesfully created on the server.")
                UD.userUploadedFirstTime = true
            
        
    
    else 
        MagicalRecord.setupCoreDataStackWithStoreNamed("scenic.sqlite")
    


    // Initialize cache with offline map regions
    SKMapsService.sharedInstance().mapsVersioningManager.delegate = self
    SKTDownloadManager.sharedInstance()
    //cachedMapRegions = Array<MapRegion>()

    // Set Map to Offline if "Get Map Data Online" is set to No
    setMapConnectivityMode()


    if TripLogger.sharedInstance.logFileExists() 
        appClosedDuringTrip = true
    

    print("APPDEL: end of applicationDidFinishLaunching")
    return true

viewDidLoad:

override func viewDidLoad() 
    super.viewDidLoad()
    print("MAPVC: viewDidLoad")
    //self.view.backgroundColor = UIColor.blackColor()




    // UI Stuff
    profilePicImageView.hidden = true
    profilePicShadowView.hidden = true
    profilePicImageViewTopConstraint.constant -= 30
    profilePicShadowViewTopConstraint.constant -= 30

    searchBar.hidden = true
    searchBarTopConstraint.constant -= 30

    settingsButton.hidden = true
    settingsButtonTopConstraint.constant -= 30

    centerOnCurrentLocationButton.hidden = true
    centerOnCurrentLocationButtonLeadingConstraint.constant -= 30

    locationsButton.hidden = true
    locationsButtonLeadingConstraint.constant -= 30

    startButton.hidden = true
    startButtonBottomConstraint.constant -= 30

    routesButton.hidden = true
    routesButtonTrailingConstraint.constant -= 30

    locationsMenuWidth.constant = 0
    locationsMenuHeight.constant = 0
    routesMenuWidth.constant = 0
    routesMenuHeight.constant = 0
    self.view.layoutIfNeeded()


    routesMenu.hidden = true
    locationsMenu.hidden = true

    centerOnCurrentLocationButtonIsHidden = centerOnCurrentLocationButton.hidden

    navInfoView.hidden = true
    searchResultsTableView.hidden = true
    cancelSearchButton.hidden = true

    profileTableView.hidden = true
    profileTableView.layer.cornerRadius = theme.cornerRadius

    profileTableView.layer.masksToBounds = false
    profileTableView.backgroundColor = theme.buttonBackgroundColor

    profileTableView.clipsToBounds = true

    searchResultsTableView.hidden = true
    searchResultsTableView.layer.cornerRadius = theme.cornerRadius

    searchResultsTableView.layer.masksToBounds = false
    searchResultsTableView.backgroundColor = theme.buttonBackgroundColor
    searchResultsTableView.clipsToBounds = true

    // ForceTouchRecognizer
    let forceTouches: Array<DFContinuousForceTouchGestureRecognizer> = [forceTouchRoutesButton, forceTouchLocationsButton]
    for f in forceTouches 
        f.timeout = 0.5
        f.forceTouchDelay = 0.3
        f.baseForceTouchPressure = 3.0
        f.triggeringForceTouchPressure = 6.0
        f.delegate = self
    



    locationsButton.addGestureRecognizer(forceTouchLocationsButton)
    routesButton.addGestureRecognizer(forceTouchRoutesButton)


    // Search Bar
    HNKGooglePlacesAutocompleteQuery.setupSharedQueryWithAPIKey(GooglePlacesAPIKey)
    searchBar.delegate = self
    searchResultsTableView.delegate = self
    searchResultsTableView.dataSource = self
    self.automaticallyAdjustsScrollViewInsets = false
    searchBar.setBackgroundImage(UIImage(), forBarPosition: .Any, barMetrics: .Default)
    searchBar.barTintColor = UIColor.clearColor()

    // Vehicle TableViewSlider
    vehiclesImageSliderView = PRSlideView()
    vehiclesImageSliderView.delegate = self
    vehiclesImageSliderView.dataSource = self
    vehiclesImageSliderView.scrollDirection = .Horizontal
    vehiclesImageSliderView.infiniteScrollingEnabled = false
    vehiclesImageSliderView.registerClass(
        PRAlbumPage.self,
        identifier: PRAlbumPage.description()
    )


    // Browse Routes
    routesInMapAreaView.hidden = true
    filterView.hidden = true
    configureFilters()


    // Profile TableView
    tvc = UITableViewController()
    tvc.tableView = self.profileTableView
    profileTableView.delegate = self
    profileTableView.dataSource = self
    let refreshControl = UIRefreshControl()
    refreshControl.frameHeight = 40
    refreshControl.attributedTitle = NSAttributedString(string: String.localizedStringWithFormat(NSLocalizedString("Last update: %@",comment:"Refreshcontrol subtitle"),LastSync.users.timeAgoSinceNowOrNever()), attributes: [NSForegroundColorAttributeName:theme.textColor])
    weak var weakSelf: MapViewController? = self
    refreshControl.addTarget(weakSelf, action: #selector(MapViewController.tableRefresh), forControlEvents: UIControlEvents.ValueChanged)
    tvc.refreshControl = refreshControl

    let appDelegate = UIApplication.sharedApplication().delegate! as! AppDelegate
    if appDelegate.appWasCompletelyClosed && UD.mapUnfolding! 
        foldMapOpen()
    
    else 
        switch CLLocationManager.authorizationStatus() 
        case CLAuthorizationStatus.NotDetermined:
            self.locManager = CLLocationManager()
            self.locManager.delegate = self
            self.locManager.requestAlwaysAuthorization()
        case CLAuthorizationStatus.Denied:
            dispatch_async(dispatch_get_main_queue()) 
                self.initializeAndAnimateMap(false)
            
        default:
            dispatch_async(dispatch_get_main_queue()) 
                self.initializeAndAnimateMap(true)
            
        
    

    let subMenuButtons: Array<UIButton> = [favoriteRoutesButton, createRouteButton, importRoutesButton, showRoutesButton, favoriteLocationsButton, createLocationButton, importLocationButton]
    for subMenuButton in subMenuButtons 
        subMenuButton.setLayerProperties(backgroundColor: UIColor.clearColor(), opacity: nil, cornerRadius: 12, borderColor: theme.tintColor, borderWidth: theme.borderWidth, shadowOffset: nil)
    
    myTripsButton.setLayerProperties(backgroundColor: UIColor.clearColor(), opacity: nil, cornerRadius: 12, borderColor: theme.okGreenColor, borderWidth: theme.borderWidth, shadowOffset: nil)


    let closeButtons: Array<UIButton> = [closeNavInfoButton, closeRoutesInMapAreaButton, closeFilterViewButton]
    for button in closeButtons 
        button.layer.cornerRadius = 10
        button.setTitle("✕", forState: .Normal)
        button.titleLabel?.textAlignment = NSTextAlignment.Center
        button.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0)
        button.titleLabel?.font = UIFont(name: "HelveticaNeue-Bold", size: 14)
        button.backgroundColor = theme.tintColor
    

    routeAvoidanceSelector = WLHorizontalSegmentedControl(items: ["avoid Tolls","avoid Highway","avoid Ferries"])
    routeAvoidanceSelector.allowsMultiSelection = true
    routeAvoidanceSelector.addTarget(weakSelf, action: #selector(MapViewController.routeAvoidanceChanged), forControlEvents: UIControlEvents.ValueChanged)

    let segControlFont = UIFont.systemFontOfSize(11, weight: UIFontWeightMedium)
    let attr = Dictionary(dictionaryLiteral: (NSFontAttributeName, segControlFont))
    routeModeSelector.setTitleTextAttributes(attr, forState: UIControlState.Normal)

    routeModeSelector.selectedSegmentIndex = UD.routeMode!.rawValue
    vehicleTypeSelector.selectedSegmentIndex = UD.vehicleType!.rawValue
    setSelectedRouteAvoidances()
    routeAvoidanceSelector.tintColor = theme.tintColor
    guidanceToStartSwitch.setOn(UD.guideToStart!, animated: false)
    navInfoView.layer.masksToBounds = true
    vehicleTypeImageView.roundCorners(UIRectCorner.BottomRight, radius: theme.textViewCornerRadius)
    vehicleTypeImageView.roundCorners([UIRectCorner.TopLeft,UIRectCorner.BottomRight], radius: theme.textViewCornerRadius)
    vehicleTypeImageView.layer.masksToBounds = true

    NSNotificationCenter.defaultCenter().addObserver(
        self,
        selector: #selector(MapViewController.resigningActive),
        name: UIApplicationWillResignActiveNotification,
        object: nil
    )
    NSNotificationCenter.defaultCenter().addObserver(
        self,
        selector: #selector(MapViewController.becomeActive),
        name: UIApplicationDidBecomeActiveNotification,
        object: nil
    )

    NSNotificationCenter.defaultCenter().addObserver(
        self,
        selector: #selector(MapViewController.deviceRotated),
        name: UIDeviceOrientationDidChangeNotification,
        object: nil
    )


【问题讨论】:

我敢猜测应用审查团队有我们无法访问的测试软件?他们有告诉你这是在什么情况下发生的吗? 他们说它“在启动时崩溃了”。一个奇怪的是,他们的崩溃报告中的“硬件模型”是 xxx,而通常它是 iPhone7,2 或 iPad 4,2 等。我猜他们可能有某种运行应用程序的自动化测试设置一次在多个设备(或模拟器???)上。我问他们 xxx 代表什么……还没有回应。 您的 Segment 显示第 210 行,但苹果崩溃日志显示第 216 行。这两个是什么? 对不起 Siris。上面的崩溃报告摘录来自我提交的初始构建。在第 210 行是 self.view.backgroundColor = UIColor.blackColor() 完整的崩溃日志来自第二次构建(我删除了 210),然后它在下一行 (216) 崩溃了它说 image view.hidden = true .在这两种情况下,它都是 viewDidLoad 的第一行。这让我觉得它不是那个视图控制器中的东西,而是其他地方(应用程序委托或全局) @Guido :你是否使用过任何全局父视图控制器意味着所有其他视图控制器都直接从该类继承。所以你在其中定义了常用的方法和函数。 【参考方案1】:

哈哈,

--@RJE... 是你的评论让我仔细检查了我是否强行解开一个可选的。如果您想要赏金,请发布答案,我会分配给您!谢谢! – 吉多 5 小时前”--

赏金总是很重要的,

无论如何,了解 SIGTRAP 的含义非常重要。它基本上是运行时异常而不是错误。因此,如果您无法真正找到问题,则必须检查是否有任何地方可以处理异常。 (特别是 Swift 可选类型)

通常它可以是超出范围的数组索引或展开 nil 或任何类似的东西。此外,如果它只是有时或仅在某些设备上发生,则可能由于 UI 动画的各种延迟而出现问题。(例如,presentViewController withAnimation 并在完成之前尝试一些事情。)

但老实说,我认为您的原始代码没有任何问题。它不应该崩溃。

除非 Storyboard 的初始点是 UINavigationController 而您忘记将其类设置为 CustomNavigationController。然后它会在下面的代码中崩溃。 (这在 Swift 中是预期的)。

let navController = window!.rootViewController as! CustomNavigationController

但我认为这不是问题所在。因为它应该在任何设备上每次都崩溃。

而且到时间 applicationDidBecomeActive 调用窗口不会为零。因此,在此之后,您可以使用 navController 执行其他操作。

或者可能是 Apple 的审核团队在有故障的设备上测试了您的应用 :)

【讨论】:

嗨。所以你有没有找到任何解决方案或其他任何东西,我有同样的问题,苹果拒绝了我的应用程序。【参考方案2】:

我得到了批准。


更新

当我获得批准时,应用程序的下一个版本再次被拒绝,同样的原因,同样的崩溃报告,再次指向 viewDidLoad 方法的第一行。

然后我将所有代码从 viewDidLoad 彻底扔到 viewWillAppear 中,如下所示:

var viewLoaded = false

override func viewDidLoad() 
    super.viewDidLoad()
    // Do nothing


override func viewWillAppear(animated: Bool) 
    if !viewLoaded 

        // viewDidLoad code

        viewLoaded = true
    

    // viewWillAppear code


我现在的理论是我发现了一个 Apple Bug:

我正在使用情节提要,而我的 rootViewController 非常(非常)重。很多 UIVIews、UILabels、MapView、Buttons、Searcher、Embedded TableView 等。我的猜测是它崩溃了,因为调用 viewDidLoad 时并非所有情节提要元素都被初始化。

如果这确实是真的(时间会证明我何时提交更多构建以供审核)我想我发现了 iOS 中的一个错误(因为我应该能够在我的 viewDidLoad 中从情节提要中引用 IBOutlets)或者与运行该应用的实际设备相比,审查运行该应用的过程(因为我和我的 400 名 Beta 测试人员都没有遇到此崩溃)。

更新结束


根据 RJE 的评论,我再次查看了我的 AppDelegate,看看我是否在强行解开某些东西。我是,但据我所知,这些值永远不会为零,所以当我第一次编码时,我没有再考虑它。我想我应该有。

在最终获得批准的版本中,有 3 件事与之前未获得批准的版本不同。

    在我的 AppDelegate didFinishLaunchingWithOptions 中,我强制解开 NSBundle.mainBundle().infoDictionary!["CFBundleVersion"]!

我变了

if UD.appVersion == nil || UD.appVersion != "\(NSBundle.mainBundle().infoDictionary!["CFBundleVersion"]!)" 
    startClean()
    UD.appVersion = "\(NSBundle.mainBundle().infoDictionary!["CFBundleVersion"]!)"

到这里

var versionInInfoDictionary = "dummy"
if let infoDict = NSBundle.mainBundle().infoDictionary 
    if let bundleVersion = infoDict["CFBundleVersion"] as? String
        versionInInfoDictionary = bundleVersion
    
    else 
        printError("bundleVersion nil")
    

else 
    printError("infoDic nil")


if UD.appVersion == nil || UD.appVersion != versionInInfoDictionary 
    startClean()
    UD.appVersion = versionInInfoDictionary

    在我的 AppDelegate applicationDidBecomeActive 中,我强制解开 window(在我的 AppDelegate 类中定义为 var window: UIWindow?

我变了

func applicationDidBecomeActive(application: UIApplication) 

    // some code

    let navController = window!.rootViewController as! CustomNavigationController

    // some code

到这里

func applicationDidBecomeActive(application: UIApplication) 

    // some code
    self.continueDidBecomeActive()


func continueDidBecomeActive() 
    guard window != nil else 
        printError("Window still nil")
        NSTimer.scheduledTimerWithTimeInterval(0.3, target: self, selector: #selector(AppDelegate.continueDidBecomeActive), userInfo: nil, repeats: false)
        return
    
    if let navController = window!.rootViewController as? CustomNavigationController 

        // some code

    

    最后,在我的构建设置中,我将“发布”的代码签名标识设置为 iOS 开发人员。我将其更改为 iOS Distribution。

现在,我认为不是第三点导致我的应用在应用审核小组中崩溃,否则它会在所有设备上崩溃,对我来说也是如此。

因此,它必须是数字 1、数字 2 或两者兼而有之。老实说,我不知道,为什么这些值在任何情况下都为零,我仍然有点困惑。如果有更多见解...我很想听听。

【讨论】:

您是否发现您的 ViewDidLoad 理论在视图准备就绪之前被调用?我的意思是应该在 loadView 期间调用情节提要代码,这应该保证在 viewDidLoad 之前发生,对吗?它们发生在串行的主线程上 没有证据。我以不同的方式解决了它,并决定不潜入 Apple 雷达兔子洞。【参考方案3】:

我遇到了类似的问题。我的测试设备上没有崩溃,但 Apple 表示他们无法启动该应用程序。

我给解决中心的审核小组发了消息。他们再次开始审查过程,无法重现崩溃。终于我的应用程序被接受了:)

【讨论】:

以上是关于应用审查小组的 EXC_BREAKPOINT (SIGTRAP)。不可重现的主要内容,如果未能解决你的问题,请参考以下文章

应用程序启动时的 EXC_BREAKPOINT (SIGTRAP)

如何诊断 iPad iPhone 应用程序中的 EXC_BREAKPOINT (SIGTRAP) 崩溃?

是调试断点导致的“EXC_BREAKPOINT (SIGTRAP)”异常吗?

线程 1: EXC_BREAKPOINT(code = EXC_I386_BPT, subcode=0x0

错误 - EXC_BREAKPOINT(代码=1,子代码=0x100308448)

EXC_BREAKPOINT 崩溃。可能的越狱问题?