[Bug]: How to handle block function #655
-
What are the steps to reproduce this issue?all the step build no error What happens?can't catch wrap of block function. when i use this code
and then only get this result when using xcode console nslog output
but when i using frida with the similar syntex it can get callback response What were you expecting to happen?I hope to catch the origin response in block function Paste any relevant logs, error output, etc.No response Additional contextNo response What OS are you seeing the problem on?macOS What OS version does it have installed?12 What toolchain and version are you using?xcode13 Which SDK version are you using?11 What OS is your client device running?iOS What OS version does it have installed?13 Which device model is it?iphone7 Which jailbreak is it using (if relevant)?No response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You may need to copy the block. By default a block is NSStackBlock, which as you can imagine, is expected to only live for a short period of time entirely on the stack. Copying will give you an NSMallocBlock that can live in the heap. As the original block is an NSMallocBlock, you likely need to do that to match. Blocks respond to -copy, so you can try: return %orig(arg1, arg2, [respblock copy]); |
Beta Was this translation helpful? Give feedback.
You may need to copy the block. By default a block is NSStackBlock, which as you can imagine, is expected to only live for a short period of time entirely on the stack. Copying will give you an NSMallocBlock that can live in the heap. As the original block is an NSMallocBlock, you likely need to do that to match. Blocks respond to -copy, so you can try: