We recently ported our Obj-c application to be cross platform with c++. We are in the process of integrating it back into iOS and have to capture a block and NSObject into a lambda, and it makes me very nervous as I do not know if it will retain the memory correctly. Here is some test code
NSString* important_string = @"Test String";
void (^important_os_callback)(parameterTypes parameter);
my_cpp_function_with_lamdba([important_string, important_os_callback]()
{
// Are the block and string still retained later?
important_os_callback(important_string);
});
Aucun commentaire:
Enregistrer un commentaire