1
votes

I have upgraded application to iOS 10 and XCode 8, after upgrading application is crashing in iPad with log as follows:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _masterColumnWidth.'

Check full crash log below:

* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _masterColumnWidth.' * First throw call stack: ( 0 CoreFoundation 0x000000010bdc634b exceptionPreprocess + 171 1 libobjc.A.dylib
0x000000010b32b21e objc_exception_throw + 48 2 CoreFoundation
0x000000010bdc6299 -[NSException raise] + 9 3 Foundation
0x0000000106ace2ff -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291 4 UIKit 0x000000010803c8c3 -[UIViewController setValue:forKey:] + 88 5 Profiler 0x0000000104319ae5 -[AppDelegate application:didFinishLaunchingWithOptions:] + 3765 6 UIKit
0x0000000107e9968e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290 7 UIKit 0x0000000107e9b013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236 8 UIKit 0x0000000107ea13b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731 9 UIKit 0x0000000107e9e539 -[UIApplication workspaceDidEndTransaction:] + 188 10 FrontBoardServices 0x00000001110ff76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
+ 24 11 FrontBoardServices 0x00000001110ff5e4 -[FBSSerialQueue _performNext] + 189 12 FrontBoardServices 0x00000001110ff96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45 13 CoreFoundation 0x000000010bd6b311 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 14 CoreFoundation 0x000000010bd5059c __CFRunLoopDoSources0 + 556 15 CoreFoundation 0x000000010bd4fa86 __CFRunLoopRun + 918 16 CoreFoundation
0x000000010bd4f494 CFRunLoopRunSpecific + 420 17 UIKit
0x0000000107e9cdb6 -[UIApplication _run] + 434 18 UIKit
0x0000000107ea2f34 UIApplicationMain + 159 19 Profiler
0x000000010458fb9f main + 111 20 libdyld.dylib
0x000000010cfa968d start + 1 21 ???
0x0000000000000001 0x0 + 1 )

Used below code to set masterColumnWidth of SpliteViewController:

SpliteViewController *objSpliteViewController = [[Navigation getStoryBord] instantiateViewControllerWithIdentifier:@"SpliteViewController"];

[objSpliteViewController setValue:[NSNumber numberWithFloat:370.0f] forKey:@"_masterColumnWidth"];

Works fine in iOS version below 10 and XCode version below 8.

1

1 Answers

0
votes

Since iOS 10 access to this internal property is not possible. Generally speaking, accessing these kind of properties is a risky practice. You should use either appropriate properties or methods to modify the master column's width:

1. Properties

objSpliteViewController.maximumPrimaryColumnWidth = 370.0;
objSpliteViewController.minimumPrimaryColumnWidth = 370.0;

2. Methods

[objSpliteViewController setMaximumPrimaryColumnWidth:370.0];
[objSpliteViewController setMinimumPrimaryColumnWidth:370.0];

Set both(maximum and minimum) to achieve exact width or just one of them to prevent column from getting too wide or too narrow.