0

Just hit a problem where I need to work with a external framework and bundle.

While the frame is imported and its functions can be called just fine, one of it's methods tries to load a nib from the accompanying bundle, which ends in a NSInternalInconsistencyException for the reason

"Could not load NIB in bundle".

I noticed that while the bundle is in the Copy Bundle Resources and can be found by calling Bundle.allBundles, the error message says the bundle is "not yet loaded". Is there something I was supposed to do so the bundle could be loaded beforehand?

Update: I did not provide the related code earlier because the error happened as a colateral effect of a framework call, so I don't know exactly how the nib is "loaded". The code itself is this:

if let request = AUTRequest.init(transactionType: .debitGeneric) {
    AUTCTFClient.executeTransaction(with: request, from: self) { (_response) in
       if let response = _response {
           print(response)
       }
    }
}

self is the current viewcontroller and the error happens after the executeTransaction call but before the response block execution.

Is this somehow related to the Bundle not being loaded or is the framework at fault himself?

2 Answers2

0

If you are using code do load the nib, you need to make sure you are loading it from the correct bundle:

let bundle = Bundle(for: ClassName.self)
let view = bundle.loadNibNamed("nib_name", owner: nil, options: nil)![0]

If you are using storyboard, please make sure to select to correct Module (the framework). You can select module in the Identity Inspector (in interface builder press cmd+alt+3).

ukim
  • 2,395
  • 15
  • 22
0

After trying to find solutions for a while, the most obvious answer is that the framework in question was compiled with missing files, that the "AUTCTFClient.executeTransaction" tries to call in its execution. This point is "confirmed" by older versions of the framework showing some kind of progress view on execution. (but sadly they were not usable in our case)

If you somehow got this problem, it'll probably be best to ask the owners(or search) for an updated or stable version of their framework.