Closed yunjinghui123 closed 1 year ago
Hello @yunjinghui123
In your example v
is not BOOL
, it's id
. Just change argument type in your example.
Hello @yunjinghui123 In your example
v
is notBOOL
, it'sid
. Just change argument type in your example.
Thank you
it's a bug based on our docs. I don't remember this function, did you add it @RomanPodymov ?
it's a bug based on our docs. I don't remember this function, did you add it @RomanPodymov ?
Hello @mxcl I also don't remember this function, but I think I explained @yunjinghui123 what is wrong. @yunjinghui123 can we close the issue?
I guess I added it years ago for some reason.
It should work like the other then()
and automatically convert from id
to BOOL
based on the provided args, but at this point I think we can all agree this “bug” is working as intended.
Hello @mxcl
As I can see promiseWithBooleanAdapterBlock
uses [NSNumber numberWithBool:]
because AnyPromise
uses id
for value
.
@yunjinghui123 So you can use NSNumber
in your example
void (^fetch)(PMKBooleanAdapter) = ^(PMKBooleanAdapter block){
block(YES, nil);
};
[AnyPromise promiseWithBooleanAdapterBlock:fetch].then(^(NSNumber* obj){
XCTAssertEqualObjects(obj, @YES);
});
fetch
I will use it this way.Thank you!
promiseWithBooleanAdapterBlock adapter(YES) ,but then value is NO, why?
Xcode15
PromiseKit8.1.1