I'm working on a PhoneGap application. The app itself seems to have handled iOS 9 fine, because it's still working, but the transition to the new Xcode has introduced a new exception that wasn't happening under the old version of Xcode.
I'm getting the following exception text:
2015-10-12 13:40:58.434 <AppName>[29769:897739] -[__NSDictionaryI length]:      unrecognized selector sent to instance 0x7ff0295c95d0
2015-10-12 13:40:58.445 <AppName>[29769:897739] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI length]: unrecognized selector sent to instance 0x7ff0295c95d0'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010d24bf65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000011061fdeb objc_exception_throw + 48
2   CoreFoundation                      0x000000010d25458d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3   CoreFoundation                      0x000000010d1a1f7a ___forwarding___ + 970
4   CoreFoundation                      0x000000010d1a1b28 _CF_forwarding_prep_0 + 120
5   UIKit                               0x000000010d857011 -[UILabel _ensureBaselineMetricsReturningBounds] + 153
6   UIKit                               0x000000010d85725e -[UILabel _firstBaselineOffsetFromTop] + 36
7   UIKit                               0x000000010de7d0c3 -[UIView(AdditionalLayoutSupport) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:onBehalfOfLayoutGuide:] + 1560
8   UIKit                               0x000000010de7ca8f -[UIView(AdditionalLayoutSupport) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:] + 74
9   Foundation                          0x00000001101f3bd8 lower_1_attribute + 158
10  Foundation                          0x00000001101f36ec -[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 102
11  Foundation                          0x00000001101e98f1 -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 96
12  UIKit                               0x000000010de79213 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 504
13  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
14  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
15  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
16  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
17  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
18  UIKit                               0x000000010de790fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 225
19  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
20  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
21  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
22  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
23  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
24  UIKit                               0x000000010d6b2fef -[UIScrollView _switchToLayoutEngine:] + 107
25  UIKit                               0x000000010de790fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 225
26  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
27  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
28  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
29  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
30  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
31  UIKit                               0x000000010de790fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 225
32  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
33  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
34  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
35  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
36  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
37  UIKit                               0x000000010de790fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 225
38  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
39  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
40  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
41  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
42  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
43  UIKit                               0x000000010de790fc __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 225
44  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
45  UIKit                               0x000000010de79637 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
46  UIKit                               0x000000010de78fd3 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 646
47  UIKit                               0x000000010de79640 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
48  UIKit                               0x000000010de78d08 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 242
49  UIKit                               0x000000010d6980dc __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 113
50  Foundation                          0x00000001101f723a -[NSISEngine withBehaviors:performModifications:] + 155
51  UIKit                               0x000000010d698024 -[UIView(Hierarchy) _postMovedFromSuperview:] + 575
52  UIKit                               0x000000010d6a5ac3 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1967
53  UIKit                               0x000000010d8e7695 -[_UIAlertControllerPresentationController presentationTransitionWillBegin] + 208
54  UIKit                               0x000000010d75999c __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2044
55  UIKit                               0x000000010d7575c5 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 309
56  UIKit                               0x000000010d6044be _runAfterCACommitDeferredBlocks + 317
57  UIKit                               0x000000010d6167ee _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
58  UIKit                               0x000000010d6224e6 _afterCACommitHandler + 90
59  CoreFoundation                      0x000000010d1779d7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
60  CoreFoundation                      0x000000010d177947 __CFRunLoopDoObservers + 391
61  CoreFoundation                      0x000000010d16d59b __CFRunLoopRun + 1147
62  CoreFoundation                      0x000000010d16ce98 CFRunLoopRunSpecific + 488
63  GraphicsServices                    0x0000000111d12ad2 GSEventRunModal + 161
64  UIKit                               0x000000010d5f8676 UIApplicationMain + 171
65  <AppName>                          0x000000010cd9c061 main + 65
66  libdyld.dylib                       0x0000000110ff192d start + 1
67  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
Looking at the code, it shows me the following as the source of the exception:
int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }       
}
With the exception coming out of the UIApplicationMain() call.  Following the stack trace further down just takes me into assembly code, which appears to be Apple libraries.  
I'm basically certain that the code problem has nothing to do with the UIApplicationMain() call directly, and is probably something else in the project file that is broken, but I can't get a lead to track down this bug for the life of me.
If I load this same project in Xcode 6.0 or 6.3 (the other two versions I've tried), no exception is thrown at this point. Even the compiled app on the store, when tested in iOS 9, doesn't seem to have this problem. So far, the problem only seems to occur when running the app in debug mode via Xcode 7.0.
Config.xml specifies to build this with phonegap-version 3.5, but I've tried other versions up to the very most recent, and all of them have this problem.
I've been trying to solve this problem for two days now, but I'm making no progress because I just can't get a handhold on what might have gone wrong. Everything I end up checking seems fine, and yet this error emerges from somewhere. I feel like this has to be a case where something is configured wrong somewhere, and so it blows up inside Apple's code wherever the misconfigured piece is finally being used, but I have absolutely no clue as to what. I'm stumped. Does anyone have any useful information that might be able to help me out?
UPDATE: I finally found it. Tucked into the debug output was a line I was overlooking:
 NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802
That led me to this question here on SO. As it turns out, that was the actual root cause of my problem. This also explained why the application was working fine in production on actual devices, and why old Xcode was just fine. The web request being made was being made against HTTPS in production, but the servers for development were HTTP instead. Thus, the production version of the app was fine, and the development version of the app was fine in old Xcode (where there was no ATS), but the development version of the app compiled against the new iOS 9 Xcode was throwing the exception.
I was so busy looking at the big exception and some other major items in that debug output that I missed the key line that was tucked between other items.
 
     
    