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
4

There are 4 answers

0
Fahad Alrashed On BEST ANSWER

I found the problem. I needed to mark OPPWAMobile.xcframework as "Embed & Sign" under Target->General->Frameworks, Libraries and Embedded Content.

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.

0
Jhonattan On

You have add OPPWAMobile-Resources.bundle on project.

enter image description here

enter image description here

0
Marvine Bamba On

In addition for adding the resource files and checking Embed & Sign in the general settings, Also make sure the order of the build phases are correct.

enter image description here

0
mintymuz On

For anyone else coming here later... this can also be caused if you call super.init in a custom initialiser of a UIViewController and enter "" as the nibName:

    init(foo: Foo) {
    self.foo = foo
    super.init(nibName: "", bundle: nil)
}

Instead, set the nibName to nil:

    init(foo: Foo) {
    self.foo = foo
    super.init(nibName: nil, bundle: nil)
}