1

My Question : Since from some time, I'm experiencing app rejection from app store. The app runs without any issue on real device ipad/iphone with iOS 14.3 (latest) and the simulators. But app store testing team claims it crashes. Apple representative said that the build is not following their guidelines. What am i doing wrong here.....

Apple Message :

We're looking forward to completing our review, but we are unable to continue because your 
app crashed during review. Please review the details below and the attached crash logs, then 
complete the next steps.

Review device details:

- Device type: iPad and iPhone
- OS version: iOS 14.3

Steps leading to crash:

1. Launch the app
2. Enter demo credentials
3. Tap the Login button
4. Observe the crash

Crash Report :

Incident Identifier: 9A6712D7-1B52-4728-9FB9-F09B4E2058EA
CrashReporter Key:   97557ca51b483f1e2c8db0cbb5a8f94b14d1ceba
Hardware Model:      iPhone11,8
Process:             
Path:                
Identifier:          
Version:             
AppStoreTools:       12D4d
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           


Date/Time:           2021-01-27 12:41:00.1952 -0800
Launch Time:         2021-01-27 12:40:44.7791 -0800
OS Version:          iPhone OS 14.3 (18C66)
Release Type:        User
Baseband Version:    3.02.02
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Last Exception Backtrace:
0   CoreFoundation                  0x197d6d86c 0x197c48000 + 1202284
1   libobjc.A.dylib                 0x1accdcc50 0x1accd6000 + 27728
2   CoreFoundation                  0x197c664a4 0x197c48000 + 124068
3   UIKitCore                       0x199f810d0 0x199b58000 + 4362448
4   UIFoundation                    0x1a0fe3374 0x1a0f64000 + 521076
5   UIFoundation                    0x1a0fe358c 0x1a0f64000 + 521612
6   UIFoundation                    0x1a0f6cc1c 0x1a0f64000 + 35868
7   UIKitCore                       0x199ff7f94 0x199b58000 + 4849556
8   Labyl                           0x102eddcc4 specialized AddBuildingViewController.init(coder:) + 629956 (AddBuildingViewController.swift:0)
9   Labyl                           0x102edc160 @objc AddBuildingViewController.init(coder:) + 622944 (<compiler-generated>:16)
10  UIKitCore                       0x19a32be54 0x199b58000 + 8207956
11  UIFoundation                    0x1a0fe3374 0x1a0f64000 + 521076
12  UIFoundation                    0x1a0fe358c 0x1a0f64000 + 521612
13  UIFoundation                    0x1a0f6cc1c 0x1a0f64000 + 35868
14  UIKitCore                       0x19a32b230 0x199b58000 + 8204848
15  UIKitCore                       0x199ff8148 0x199b58000 + 4849992
16  UIKitCore                       0x199f213d0 0x199b58000 + 3970000
17  UIFoundation                    0x1a0fe3374 0x1a0f64000 + 521076
18  UIFoundation                    0x1a0fe358c 0x1a0f64000 + 521612
19  UIFoundation                    0x1a0f6cc1c 0x1a0f64000 + 35868
20  UIKitCore                       0x19a32b230 0x199b58000 + 8204848
21  UIKitCore                       0x199ff8148 0x199b58000 + 4849992
22  UIKitCore                       0x199f030a8 0x199b58000 + 3846312
23  UIKitCore                       0x19a32be54 0x199b58000 + 8207956
24  UIFoundation                    0x1a0fe3374 0x1a0f64000 + 521076
25  UIFoundation                    0x1a0f6cc1c 0x1a0f64000 + 35868
26  UIKitCore                       0x19a33038c 0x199b58000 + 8225676
27  UIFoundation                    0x1a0fe3374 0x1a0f64000 + 521076
28  UIFoundation                    0x1a0fe358c 0x1a0f64000 + 521612
29  UIFoundation                    0x1a0f6cc1c 0x1a0f64000 + 35868
30  UIKitCore                       0x19a32b008 0x199b58000 + 8204296
31  UIKitCore                       0x19a32dae0 0x199b58000 + 8215264
32  UIKitCore                       0x19a8a5d9c 0x199b58000 + 13950364
33  UIKitCore                       0x19a8a5c34 0x199b58000 + 13950004
34  UIKitCore                       0x19a8a694c 0x199b58000 + 13953356
35  UIKitCore                       0x19a8a6b64 0x199b58000 + 13953892
36  UIKitCore                       0x199ffff48 0x199b58000 + 4882248
37  Labyl                           0x102ea4bf8 InitialViewController.viewDidAppear(_:) + 396280 (InitialViewController.swift:0)
38  Labyl                           0x102ea4c40 @objc InitialViewController.viewDidAppear(_:) + 396352 (<compiler-generated>:0)
39  UIKitCore                       0x19a002d8c 0x199b58000 + 4894092
40  UIKitCore                       0x19a003768 0x199b58000 + 4896616
41  UIKitCore                       0x19a003aa8 0x199b58000 + 4897448
42  UIKitCore                       0x199ede9a0 0x199b58000 + 3697056
43  UIKitCore                       0x199ede77c 0x199b58000 + 3696508
44  UIKitCore                       0x199ee8f54 0x199b58000 + 3739476
45  UIKitCore                       0x199ee2f80 0x199b58000 + 3714944
46  UIKitCore                       0x19a027bcc 0x199b58000 + 5045196
47  UIKitCore                       0x19ac29de8 0x199b58000 + 17636840
48  UIKitCore                       0x19ac29a94 0x199b58000 + 17635988
49  UIKitCore                       0x19ac619ac 0x199b58000 + 17865132
50  UIKitCore                       0x19ac33cc8 0x199b58000 + 17677512
51  UIKitCore                       0x19ac34230 0x199b58000 + 17678896
52  UIKitCore                       0x19ac34394 0x199b58000 + 17679252
53  QuartzCore                      0x19b19e5e4 0x19b029000 + 1529316
54  libdispatch.dylib               0x197961db0 0x19795e000 + 15792
55  libdispatch.dylib               0x19796f7ac 0x19795e000 + 71596
56  CoreFoundation                  0x197ce911c 0x197c48000 + 659740
57  CoreFoundation                  0x197ce3120 0x197c48000 + 635168
58  CoreFoundation                  0x197ce221c 0x197c48000 + 631324
59  GraphicsServices                0x1af7e6784 0x1af7e3000 + 14212
60  UIKitCore                       0x19a720fe0 0x199b58000 + 12357600
61  UIKitCore                       0x19a726854 0x199b58000 + 12380244
62  libswiftUIKit.dylib             0x1abf9e5bc 0x1abf88000 + 91580
63  Labyl                           0x102ec7da8 main + 540072 (AppDelegate.swift:0)
64  libdyld.dylib                   0x1979a26b0 0x1979a1000 + 5808


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001c5ae4414 0x1c5abc000 + 164884
1   libsystem_pthread.dylib         0x00000001e353eb40 0x1e353c000 + 11072
2   libsystem_c.dylib               0x00000001a110ab74 0x1a1094000 + 486260
3   libc++abi.dylib                 0x00000001acde2cf8 0x1acdcf000 + 81144
4   libc++abi.dylib                 0x00000001acdd3e4c 0x1acdcf000 + 20044
5   libobjc.A.dylib                 0x00000001accdcf64 0x1accd6000 + 28516
6   libc++abi.dylib                 0x00000001acde20e0 0x1acdcf000 + 78048
7   libc++abi.dylib                 0x00000001acde206c 0x1acdcf000 + 77932
8   libdispatch.dylib               0x0000000197961dc4 0x19795e000 + 15812
9   libdispatch.dylib               0x000000019796f7ac 0x19795e000 + 71596
10  CoreFoundation                  0x0000000197ce911c 0x197c48000 + 659740
11  CoreFoundation                  0x0000000197ce3120 0x197c48000 + 635168
12  CoreFoundation                  0x0000000197ce221c 0x197c48000 + 631324
13  GraphicsServices                0x00000001af7e6784 0x1af7e3000 + 14212
14  UIKitCore                       0x000000019a720fe0 0x199b58000 + 12357600
15  UIKitCore                       0x000000019a726854 0x199b58000 + 12380244
16  libswiftUIKit.dylib             0x00000001abf9e5bc 0x1abf88000 + 91580
17  Labyl                           0x0000000102ec7da8 main + 540072 (AppDelegate.swift:0)
18  libdyld.dylib                   0x00000001979a26b0 0x1979a1000 + 5808

Notes

  • My Initial View Controller is "InitialViewController" where i check user authentication.
  • Done all the screens in storyboard
  • Done using Swift 4.2. Originally created by using xcode 10.3. Trying to build this version using xcode 12.3 and targeted to iOS 10.0 =<

enter image description here

enter image description here

AddBuildingViewController :

    import UIKit
    import MapKit
    import CoreLocation
    import PKHUD
    import Alamofire
    import AVFoundation
    
    class AddBuildingViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
     ............
     ............
    
     override func viewDidLoad() {
         super.viewDidLoad()
        
         .........
        
     }
    
     override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        print("from add new view controller view did appear")
        ..........
     }
    
     override func viewDidDisappear(_ animated: Bool) {
        .........
     }
    
     override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        .......
     }
    
     override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        .........
     }
    
    }

InitialViewController :

import UIKit

class InitialViewController: UIViewController {

    override func viewDidLoad(){
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        self.navigationController?.navigationBar.barTintColor = #colorLiteral(red: 0.2196078431, green: 0.4705882353, blue: 0.9137254902, alpha: 1)
        self.navigationController?.navigationBar.tintColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
        
        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
        
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        print("Initial View Controller : ViewDidAppear")
        if UserDefaults.standard.object(forKey: "loginTokenDict") == nil {
            print("go to login")
            self.performSegue(withIdentifier: "loginSegue", sender: self)
        } else {
            print("go to dashboard")
            self.performSegue(withIdentifier: "viewDashBoard", sender: self)
        }
    }
}

Appdelegate FIle :

import UIKit
import CoreData
import AVFoundation

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
//        
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
        // Saves changes in the application's managed object context before the application terminates.
        self.saveContext()
    }

    // MARK: - Core Data stack

    lazy var applicationDocumentsDirectory: URL = {
        // The directory the application uses to store the Core Data store file. This code uses a directory named "com.essindia.Archguide" in the application's documents Application Support directory.
        let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
        return urls[urls.count-1]
    }()

    lazy var managedObjectModel: NSManagedObjectModel = {
        // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
        let modelURL = Bundle.main.url(forResource: "Archguide", withExtension: "momd")!
        return NSManagedObjectModel(contentsOf: modelURL)!
    }()

    lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
        // The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
        // Create the coordinator and store
        let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
        let url = self.applicationDocumentsDirectory.appendingPathComponent("SingleViewCoreData.sqlite")
        var failureReason = "There was an error creating or loading the application's saved data."
        do {
            try coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil)
        } catch {
            // Report any error we got.
            var dict = [String: AnyObject]()
            dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" as AnyObject
            dict[NSLocalizedFailureReasonErrorKey] = failureReason as AnyObject

            dict[NSUnderlyingErrorKey] = error as NSError
            let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
            // Replace this with code to handle the error appropriately.
            // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
            NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
            //abort()
        }
        
        return coordinator
    }()

    lazy var managedObjectContext: NSManagedObjectContext = {
        // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
        let coordinator = self.persistentStoreCoordinator
        var managedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
        managedObjectContext.persistentStoreCoordinator = coordinator
        return managedObjectContext
    }()

    // MARK: - Core Data Saving support

    func saveContext () {
        if managedObjectContext.hasChanges {
            do {
                try managedObjectContext.save()
            } catch {
                // Replace this implementation with code to handle the error appropriately.
                // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                let nserror = error as NSError
                NSLog("Unresolved error \(nserror), \(nserror.userInfo)")
                //abort()
            }
        }
    }
    
    // MARK: UISceneSession Lifecycle
    
    @available(iOS 13, *)
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }
    
    @available(iOS 13, *)
    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }


}

Scenedelegate File : (I added manually for iOS 14)

import UIKit

@available(iOS 13.0, *)
class SceneDelegate : UIResponder, UIWindowSceneDelegate {
    
    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
        // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
        // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
        //guard let _ = (scene as? UIWindowScene) else { return }
        
//        guard let windowScene = scene as? UIWindowScene else { return }
//        let window = UIWindow(windowScene: windowScene)
//        // Provide your apps root view controller
//        window.rootViewController = InitialViewController()
//        self.window = window
//        window.makeKeyAndVisible()
        
        if let windowScene = scene as? UIWindowScene {
                let storyboard = UIStoryboard(name: "Main", bundle: nil)
                    var vc : UIViewController = storyboard.instantiateViewController(withIdentifier: "InitialViewController") as UIViewController
                    self.window = UIWindow(windowScene: windowScene)
                    self.window?.rootViewController = vc
                    self.window?.makeKeyAndVisible()
                }
    }

    func sceneDidDisconnect(_ scene: UIScene) {
        // Called as the scene is being released by the system.
        // This occurs shortly after the scene enters the background, or when its session is discarded.
        // Release any resources associated with this scene that can be re-created the next time the scene connects.
        // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
    }

    func sceneDidBecomeActive(_ scene: UIScene) {
        // Called when the scene has moved from an inactive state to an active state.
        // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
    }

    func sceneWillResignActive(_ scene: UIScene) {
        // Called when the scene will move from an active state to an inactive state.
        // This may occur due to temporary interruptions (ex. an incoming phone call).
    }

    func sceneWillEnterForeground(_ scene: UIScene) {
        // Called as the scene transitions from the background to the foreground.
        // Use this method to undo the changes made on entering the background.
    }

    func sceneDidEnterBackground(_ scene: UIScene) {
        // Called as the scene transitions from the foreground to the background.
        // Use this method to save data, release shared resources, and store enough scene-specific state information
        // to restore the scene back to its current state.
    }
}

Edited plist for new Scenedelegate section :

<key>UIApplicationSceneManifest</key>
    <dict>
        <key>UIApplicationSupportsMultipleScenes</key>
        <false/>
        <key>UISceneConfigurations</key>
        <dict>
            <key>UIWindowSceneSessionRoleApplication</key>
            <array>
                <dict>
                    <key>UISceneConfigurationName</key>
                    <string>Default Configuration</string>
                    <key>UISceneDelegateClassName</key>
                    <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
                    <key>UISceneStoryboardFile</key>
                    <string>Main</string>
                </dict>
            </array>
        </dict>
    </dict>

enter image description here

Am i doing something wrong introducing the Scenedelegate to the project since I need support for both iOS 12 and earlier and 13.0 +? And my Appdelegate is already being used when terminating the app

Thush-Fdo
  • 506
  • 1
  • 9
  • 28
  • 1
    Some insight. I believe Apple testers use physical devices that are factory reset before each test they run. I would suggest you test on a physical device with a new clear/clean tester email address to try and observe the crash yourself. Then you could start to try and figure out why it is happening. Follow the steps they say causes the crash.. – JerseyDevel Jan 30 '21 at 19:57
  • Also, if you really can’t reproduce the crash, and if your app doesn’t yet contain too much proprietary data that you’d be afraid someone would steal it from you, since you seem to have posted most of your app here, put up a copy on GitHub so someone else can download the app and try to get it to crash... – JerseyDevel Jan 30 '21 at 20:04
  • @Lkabo there are certain things that i can't share in the app. do you think i've shared things that i shouldn't have? can you explain or share more details on that factory reset devices? – Thush-Fdo Jan 30 '21 at 20:07
  • Is `AddBuildingViewController` where you get to by performing the `viewDashBoard` segue? If not, how do you get to it? Have you tested a TestFlight build? Is `InitialViewController` embedded in a navigation controller? (It doesn't appear to be) have you tried putting the `performSegue` in a `DispatchQueue.main.asyncAfter`? How about simply replacing the scenes root view controller? – Paulw11 Jan 30 '21 at 20:15
  • Have you implemented `init(coder:)` in `AddBuildingViewController`? Do you have any deprecation warnings when you build? – Paulw11 Jan 30 '21 at 20:22
  • @Paulw11 viewDashBoard segue goes to a UITabBarController. No InitialViewController is standalone. What is benefit of making some delay to the performSegue? Do you think it needs more time than usual? – Thush-Fdo Jan 30 '21 at 20:25
  • @Paulw11 no init coder in AddBuildingViewController. and no deprecation warnings. In fact unless user tap on the tab and go to that View, no code in that viewcontroller is triggered. especially at the time of the login and for logged user when showing the dashBoard Tab bar view – Thush-Fdo Jan 30 '21 at 20:27
  • I was working under the assumption that you were segueing to the view controller in question from `viewDidAppear`, but you aren't. Is the crashing view controller in an embed segue in the tab bar controller? The crash is occurring when iOS loads that viewcontroller from the storyboard. You need to see if you see the crash when you run a TestFlight build. – Paulw11 Jan 30 '21 at 20:34
  • @Paulw11 yes. AddBuildingViewController is the 3rd tab in that tabbarviewcontroller (index =2). So just get things straight and understand this more, when app is trying to load the tabbarcontroller for the first time it tries to load all 5 tabs and in the middle 3rd tab fails thus the crash happen??? – Thush-Fdo Feb 01 '21 at 08:20
  • That's what it looks like from the stack trace `init(coder:)` is called to create the view controller from the storyboard file – Paulw11 Feb 01 '21 at 08:31
  • @Paulw11 I disconnected the AddBuildingViewController from the storyboard from UITabBarController and uploaded another version to app store. This time it rejected by pointing the 4th UIViewController originally attached to the UITabBarController. Do you have any idea what is going on? If possible i would like to have a one to one hangout with you. I need this to resolve soon please..... – Thush-Fdo Feb 01 '21 at 12:14
  • Do you experience the crash with a TestFlight build? Do you experience the problem if you run a release build signed ad-hoc? Have you had any luck in further symbolicating the crash log? If you can reproduce the crash in a TestFlight or ad hoc build then you can start to eliminate things and test more rapidly than resubmitting for review. – Paulw11 Feb 01 '21 at 19:35

0 Answers0