Closed erikjalevik closed 6 years ago
Furthermore:
// Fails with 'Unable to find method asymmetricMatch_ on object (null)'
expect(errorOut).toEqual({});
Hi, sorry for the late response i only just saw the issue.
Due to how JavaScript passes objects when calling a function, it's impossible to set the parameter to null
. Therefore, a simple errorOut === null
check won't work.
However, I added a helper function (objc.isNull
) to check whether an object is nil
(ie whether an objc.Instance
object is holding a nil
reference).
Example
const error = objc.allocRef();
NSFileManager.defaultManager().trashItemAtURL_resultingItemURL_error_(nsUrl, null, error);
console.log(objc.isNull(error)); // -> prints "true"
(You'll have to update to v0.17)
This is a follow-up question to my previous one, and again I'm not sure if it's a bug or I'm doing something wrong.
I'm trying to check that the
errorOut
variable is null in the following code:But I seem to need some other way of converting a null
NSError*
into JS land.