为什么从不调用我的完成处理程序?
Why my completion handler is never called?
我正在尝试调用完成处理程序,但从未调用过。
我做错了什么?
我看到第一个 NSLog ("Enter in my second funcition"),但第二个 NSlog ("completion handler") 从未出现在我的控制台中。
这里是函数的定义和完成的调用者
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
- (void)mySecondFunction
{
NSLog(@"Enter in my Second function");
[self myFirstFunction:true
numberOfBrothers:1
completion:^{
NSLog(@"COMPLETION HANDLER");
}];
}
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
{
NSLog(@"Enter in my First function");
}
谢谢
您的第一个函数没有调用完成。
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
{
NSLog(@"Enter in my First function");
completion();
}
我正在尝试调用完成处理程序,但从未调用过。 我做错了什么?
我看到第一个 NSLog ("Enter in my second funcition"),但第二个 NSlog ("completion handler") 从未出现在我的控制台中。
这里是函数的定义和完成的调用者
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
- (void)mySecondFunction
{
NSLog(@"Enter in my Second function");
[self myFirstFunction:true
numberOfBrothers:1
completion:^{
NSLog(@"COMPLETION HANDLER");
}];
}
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
{
NSLog(@"Enter in my First function");
}
谢谢
您的第一个函数没有调用完成。
- (void)myFirstFunction:(BOOL)selected numberOfBrothers:(int)brothers completion:(void (^)(void))completion
{
NSLog(@"Enter in my First function");
completion();
}