How to solve NSInternalInconsistencyException: reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)' - swift

I get an NSInternalInconsistencyException when I use the OPPWAMobile payment library. I need to pass name somehow to OPPPaymentSchemeViewController so it passes it to initWithNibName. But I'm not sure how to do that in Xcode.
I've checked this stack overflow solution but it didn't help because I don't have direct access to the view controller.
I'm sure that the nib name is part of a property file somewhere but I'm not able to locate it.
Any ideas on how to do that?
2021-06-22 08:24:27.468604+0300 Runner[6738:85985] *** Assertion failure in -[UINib initWithNibName:directory:bundle:], UINib.m:97
2021-06-22 08:25:12.078452+0300 Runner[6738:85985] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20422fba __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20193ff5 objc_exception_throw + 48
2 CoreFoundation 0x00007fff20422de3 +[NSException raise:format:] + 0
3 Foundation 0x00007fff207748e7 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff242b63de -[UINib initWithNibName:directory:bundle:] + 309
5 UIKitCore 0x00007fff242b6489 +[UINib nibWithNibName:bundle:] + 76
6 OPPWAMobile 0x00000001067e9736 -[OPPPaymentSchemeViewController registerTableViewCellNibs] + 153
7 OPPWAMobile 0x00000001067e9389 -[OPPPaymentSchemeViewController viewDidLoad] + 157
8 UIKitCore 0x00007fff23f806a9 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 88
9 UIKitCore 0x00007fff23f8504c -[UIViewController loadViewIfRequired] + 1084
10 UIKitCore 0x00007fff23f85436 -[UIViewController view] + 27
11 UIKitCore 0x00007fff23ec6559 -[UINavigationController _preferredContentSizeForcingLoad:] + 198
12 UIKitCore 0x00007fff23e64354 -[UIPresentationController preferredContentSizeDidChangeForChildContentContainer:] + 64
13 UIKitCore 0x00007fff23e6018f __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.466 + 178
14 UIKitCore 0x00007fff24bb1e36 -[_UIAfterCACommitBlock run] + 54
15 UIKitCore 0x00007fff246d01f8 _runAfterCACommitDeferredBlocks + 333
16 UIKitCore 0x00007fff246c01e4 _cleanUpAfterCAFlushAndRunDeferredBlocks + 221
17 UIKitCore 0x00007fff246f1a36 _afterCACommitHandler + 85
18 CoreFoundation 0x00007fff2038fd31 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
19 CoreFoundation 0x00007fff2038a542 __CFRunLoopDoObservers + 541
20 CoreFoundation 0x00007fff2038aaf5 __CFRunLoopRun + 1129
21 CoreFoundation 0x00007fff2038a1a7 CFRunLoopRunSpecific + 567
22 GraphicsServices 0x00007fff2b874d85 GSEventRunModal + 139
23 UIKitCore 0x00007fff246c14df -[UIApplication _run] + 912
24 UIKitCore 0x00007fff246c639c UIApplicationMain + 101
25 Runner 0x00000001064fec8b main + 75
26 libdyld.dylib 0x00007fff2025abbd start + 1
)
libc++abi: terminating with uncaught exception of2021-06-22 08:25:12.691736+0300 Runner[6738:88777] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)'
terminating with uncaught exception of type NSException

I found the problem. I needed to mark OPPWAMobile.xcframework as "Embed & Sign" under Target->General->Frameworks, Libraries and Embedded Content.
I suspected that this may be the problem when I read the Apple documentation on how initWithNibName:bundle: behaves when nibName is nil.
If you specify nil for the nibName parameter and you do not override
the loadView method, the view controller searches for a nib file as
described in the nibName property.
Which means that I was getting an exception because the framework couldn't find the necessary nib file.

You have add OPPWAMobile-Resources.bundle on project.

Related

UITableView unable to dequeue a cell with identifier [duplicate]

This question already has answers here:
Swift 'unable to dequeue a cell with identifier intervalCellIdentifier
(3 answers)
Closed 2 years ago.
I get this issue when i run my xcode Project. i will start the project and the simulator will load but as soon as it loads up the app i am making it crashes.
This is the error code :Thread 1: Exception: "unable to dequeue a cell with identifier ChecklistItem - must register a nib or a class for the identifier or connect a prototype cell in a storyboard"
and says this in the terminal:
2020-07-24 18:11:06.757164+0100 Checklists[983:49709] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.31.102/UITableView.m:8724
2020-07-24 18:11:06.771044+0100 Checklists[983:49709] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier ChecklistItem - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b93ae6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x000000010a23a9b2 objc_exception_throw + 48
2 CoreFoundation 0x000000010b93abe8 +[NSException raise:format:arguments:] + 88
3 Foundation 0x0000000109c1bbd2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x000000010e53d6be -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:] + 1332
5 UIKitCore 0x000000010e53d156 -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] + 91
6 Checklists 0x0000000109979a38 $s10Checklists23ChecklistViewControllerC05tableC0_12cellForRowAtSo07UITableC4CellCSo0jC0C_10Foundation9IndexPathVtF + 264
7 Checklists 0x0000000109979b25 $s10Checklists23ChecklistViewControllerC05tableC0_12cellForRowAtSo07UITableC4CellCSo0jC0C_10Foundation9IndexPathVtFTo + 165
8 UIKitCore 0x000000010e556e96 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 867
9 UIKitCore 0x000000010e520522 -[UITableView _updateVisibleCellsNow:] + 3010
10 UIKitCore 0x000000010e54024e -[UITableView layoutSubviews] + 194
11 UIKitCore 0x000000010e8465f4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
12 QuartzCore 0x00000001103b1260 -[CALayer layoutSublayers] + 255
13 QuartzCore 0x00000001103b73eb _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 523
14 QuartzCore 0x00000001103c2a8a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
15 QuartzCore 0x000000011030ba7c _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
16 QuartzCore 0x000000011033f467 _ZN2CA11Transaction6commitEv + 649
17 UIKitCore 0x000000010e3566c3 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
18 CoreFoundation 0x000000010b89eabc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
19 CoreFoundation 0x000000010b89e1b3 __CFRunLoopDoBlocks + 195
20 CoreFoundation 0x000000010b898fa3 __CFRunLoopRun + 995
21 CoreFoundation 0x000000010b8988a4 CFRunLoopRunSpecific + 404
22 GraphicsServices 0x0000000114910bbe GSEventRunModal + 139
23 UIKitCore 0x000000010e33e968 UIApplicationMain + 1605
24 Checklists 0x000000010997aa1b main + 75
25 libdyld.dylib 0x000000010c8581fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Based on the error, you did not register the cell when setting up the tableview.
Check the documentation:
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "DefaultCell")
Or
tableView.register(UINib(nibName: "yourNib", bundle: nil), forCellReuseIdentifier: "CellFromNib")
Just fill in the proper values for cell, nibName, identifier, etc... Depending on which method you're using
And here is a link to a guide if you need a bit more info: link

iOS exception handling problem

I have problem in following code.
int i = 10;
NSString *str;
#try {
//Error
str = [[NSString alloc] initWithFormat:#"%#",i];
//Warning
NSLog(#"%i",str);
}
#catch (id exception) {
NSLog(#"Hello !!!");
}
Please help me out how to handle exception in i/o operation.
Thanks.
Edited by Justin
there's no suitable place for me to provide this program to you, so i put it here.
try using the following program to reformulate your question:
static void bad_program() {
#try {
id array = [NSArray array];
NSLog(#"will throw...");
[array stringByAbbreviatingWithTildeInPath];
}
#catch (id exception) {
NSLog(#"\n*** Caught Exception:\n***** Exception Detail: %#\nResolution: Exception swallowed\n", exception);
}
}
# Justin, Result of above code
It does not fire exception. It is crashed showing following error.
Sorry Justin, please see if you could help me more. Thanks.
2011-08-25 15:06:48.444 TestError[5120:b303] will throw...
2011-08-25 15:06:48.446 TestError[5120:b303] -[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector sent to instance 0x4b38e10
2011-08-25 15:06:48.465 TestError[5120:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector sent to instance 0x4b38e10'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc05a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f14313 objc_exception_throw + 44
2 CoreFoundation 0x00dc20bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d31966 ___forwarding___ + 966
4 CoreFoundation 0x00d31522 _CF_forwarding_prep_0 + 50
5 TestError 0x00002454 -[TestErrorViewController viewDidLoad] + 164
6 UIKit 0x000c2089 -[UIViewController view] + 179
7 UIKit 0x00035d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 TestError 0x00002087 -[TestErrorAppDelegate application:didFinishLaunchingWithOptions:] + 135
9 UIKit 0x00012c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
10 UIKit 0x00014d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
11 UIKit 0x0001f617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x00017abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001cf2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ff9992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d01cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00cfef83 __CFRunLoopRun + 979
18 CoreFoundation 0x00cfe840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00cfe761 CFRunLoopRunInMode + 97
20 UIKit 0x000147d2 -[UIApplication _run] + 623
21 UIKit 0x00020c93 UIApplicationMain + 1160
22 TestError 0x00001fc9 main + 121
23 TestError 0x00001f45 start + 53
24 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
I got answer of this question.
Some exception cannnot catch and some exception will only work for device not on the simulator.

CustomCell Crash

I am using CustomCell tableview, download data and binding it.When i tap multiple time am getting this error.
[NSCFString numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x1bd170
Sat Jan 22 12:03:26 unknown Fridge[535] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x1bd170'
*** Call stack at first throw:
(
0 CoreFoundation 0x314d0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x319a149d objc_exception_throw + 24
2 CoreFoundation 0x314d2133 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x31479aa9 ___forwarding___ + 508
4 CoreFoundation 0x31479860 _CF_forwarding_prep_0 + 48
5 UIKit 0x339023fb -[UITableViewRowData(UITableViewRowDataPrivate) _updateNumSections] + 66
6 UIKit 0x3390235b -[UITableViewRowData invalidateAllSections] + 50
7 UIKit 0x33902111 -[UITableView(_UITableViewPrivate) _updateRowData] + 64
8 UIKit 0x33902069 -[UITableView noteNumberOfRowsChanged] + 64
9 UIKit 0x33901bff -[UITableView reloadData] + 582
10 UIKit 0x33904a0b -[UITableView _reloadDataIfNeeded] + 50
11 UIKit 0x33904e63 -[UITableView layoutSubviews] + 18
12 UIKit 0x338b10cf -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
13 CoreFoundation 0x3146ebbf -[NSObject(NSObject) performSelector:withObject:] + 22
14 QuartzCore 0x30a6c685 -[CALayer layoutSublayers] + 120
15 QuartzCore 0x30a6c43d CALayerLayoutIfNeeded + 184
16 QuartzCore 0x30a6656d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212
17 QuartzCore 0x30a66383 _ZN2CA11Transaction6commitEv + 190
18 QuartzCore 0x30a89f9d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
19 CoreFoundation 0x31460c59 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
20 CoreFoundation 0x31460acd __CFRunLoopDoObservers + 412
21 CoreFoundation 0x314580cb __CFRunLoopRun + 854
22 CoreFoundation 0x31457c87 CFRunLoopRunSpecific + 230
23 CoreFoundation 0x31457b8f CFRunLoopRunInMode + 58
24 GraphicsServices 0x35d664ab GSEventRunModal + 114
25 GraphicsServices 0x35d66557 GSEventRun + 62
26 UIKit 0x338d5329 -[UIApplication _run] + 412
27 UIKit 0x338d2e93 UIApplicationMain + 670
28 Fridge 0x00002a7f main + 70
29 Fridge 0x00002a34 start + 40
)
Sat Jan 22 12:03:26 unknown UIKitApplication:com.sdi.Fridge[0xa6da][535] <Notice>: terminate called after throwing an instance of 'NSException'
**Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x184250'**
Thanks
Thanks for the detail view of your problem but the only important part is this
-[NSCFString numberOfSectionsInTableView:]: unrecognized selector
It tells that you are calling the method numberOfSectionsInTableView: on a NSCFString
which is seem to be wrong
so check where is that method called in your code
And also the rest is not require in your case.
Edit:
did you release your custom cell in the delegate method tableview. if yes than use autorelease instead.

Assertion Failure

I am developing an iPad application with SDK4.2. I have a very strange error when touching any textField in my application. The first time I touch, the keyboard is shown, but when a second touch is done in the object I obtain following trace.
And it occurs also in any TextField shown in a HTML page with a UIWebView object.
Any ideas?
I am really confused with this.. Thanks in advance!
2010-12-17 11:53:11.697 BancoPopular[48914:207] *** Assertion failure in -[UIButtonLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UILabel.m:314
2010-12-17 11:53:11.699 BancoPopular[48914:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
*** Call stack at first throw:
(
0 CoreFoundation 0x01730be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x018855c2 objc_exception_throw + 47
2 CoreFoundation 0x016e9628 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0013947b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0045d1dc -[UILabel setTextColor:] + 164
5 UIKit 0x0052177b -[UIButton layoutSubviews] + 1337
6 UIKit 0x005f3420 -[UICalloutBarButton layoutSubviews] + 54
7 QuartzCore 0x011a4451 -[CALayer layoutSublayers] + 181
8 QuartzCore 0x011a417c CALayerLayoutIfNeeded + 220
9 QuartzCore 0x011a4088 -[CALayer layoutIfNeeded] + 111
10 UIKit 0x0051f2ff -[UIButton titleLabel] + 81
11 UIKit 0x005f81d1 -[UICalloutBarButton setContentScale:] + 141
12 UIKit 0x005f6c5d -[UICalloutBar _updateVisibleItems] + 2240
13 UIKit 0x005f2970 -[UICalloutBar appear] + 211
14 UIKit 0x005eaaa9 -[UITextSelectionView showCommandsWithReplacements:] + 291
15 Foundation 0x000bd7f6 __NSFireDelayedPerform + 441
16 CoreFoundation 0x01711fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
17 CoreFoundation 0x01713594 __CFRunLoopDoTimer + 1220
18 CoreFoundation 0x0166fcc9 __CFRunLoopRun + 1817
19 CoreFoundation 0x0166f240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x0166f161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01e25268 GSEventRunModal + 217
22 GraphicsServices 0x01e2532d GSEventRun + 115
23 UIKit 0x0034d42e UIApplicationMain + 1160
24 BancoPopular 0x0000292e main + 84
25 BancoPopular 0x000028d1 start + 53
26 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Look carefully what exception was about. It said "reason: 'Invalid parameter not satisfying: color'", somewhere in your code, you provide wrong parameter that is supposed to be valid colors. Apparently, it seems like you use UIButton with label and set its color but not valid.
My guess is that you have some object going away somewhere, and that object contains the "color" value.
Most likely you received an autoreleased value from some call and did not retain it, so it went "poof" when the UI came up for air.

Terminating app due to uncaught exception 'NSInvalidArgumentException'

I am using ShareKit to allow the user to share their score on Twitter and Facebook in my iPhone app. However, it seems to crash shortly after sharing on either service. I get an console message which says:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString rangeOfString:options:range:locale:]: nil argument'
*** Call stack at first throw:
(
0 CoreFoundation 0x026d6919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x028245de objc_exception_throw + 47
2 CoreFoundation 0x0268f078 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0268efea +[NSException raise:format:] + 58
4 Foundation 0x0008f97b -[NSString rangeOfString:options:range:locale:] + 424
5 Foundation 0x0009de16 -[NSString rangeOfString:] + 104
6 iPhone Typer 0x00030220 -[SHKOAuthView webView:shouldStartLoadWithRequest:navigationType:] + 151
7 UIKit 0x004bb456 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 458
8 CoreFoundation 0x0264742d __invoking___ + 29
9 CoreFoundation 0x02647301 -[NSInvocation invoke] + 145
10 WebCore 0x030940f0 _ZL20HandleDelegateSourcePv + 64
11 CoreFoundation 0x026b7d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x026162cb __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x026157c6 __CFRunLoopRun + 470
14 CoreFoundation 0x02615280 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x026151a1 CFRunLoopRunInMode + 97
16 GraphicsServices 0x02e5e2c8 GSEventRunModal + 217
17 GraphicsServices 0x02e5e38d GSEventRun + 115
18 UIKit 0x00339b58 UIApplicationMain + 1160
19 iPhone Typer 0x00002894 main + 102
20 iPhone Typer 0x00002825 start + 53
)
terminate called after throwing an instance of 'NSException'
How would I fix this? Thanks.
Set a breakpoint on objc_exception_throw, then build the app for debug, run the app with breakpoints on and cause the crash again, then go up the stack to the relevant code.
Something inside SHKOAuthView webView:shouldStartLoadWithRequest:navigationType: is passing a nil argument to NSString rangeOfString. When you know what is passing the nil, it may be obvious what the problem is - failing that update your question with the relevant code and any extra information you've determined.