Short answer: parameter is not used in implementation of block in iOS 10 (guess that in iOS 9 too, but can't check right now).
Long answer: let's see what happens inside of completion
block:
___50-[UIApplication _handleApplicationShortcutAction:]_block_invoke:
push rbp ; XREF=-[UIApplication _handleApplicationShortcutAction:]+132
mov rbp, rsp
mov rax, qword [ds:rdi+0x20]
mov rdx, qword [ds:rdi+0x28]
mov rsi, qword [ds:0x1179e88] ; @selector(_updateSnapshotAndStateRestorationWithAction:)
mov rdi, rax ; argument "instance" for method imp___got__objc_msgSend
pop rbp
jmp qword [ds:imp___got__objc_msgSend]
; endp
I run this on Intel64, so first argument should be stored in rdi
register (when we calling block under ARC it is an instance of NSMallocBlock
). There is no selector, so second parameter (bool argument) should be stored in rsi
register. But rsi
register is not used in code - it just sends message _updateSnapshotAndStateRestorationWithAction:
to object ds:rdi+0x20
with argument ds:rdi+0x28
.
Both ds:rdi+0x20
and ds:rdi+0x28
are captured pointers inside of the block.
Think that the guess with parameter as indicator for snapshot function was wrong.
completionHandler
(also your responsibility to implement), so in the implementation ofapplication(_:performActionFor:completionHandler:)
you could pass a bool that can make sense to the logic that you implemented on thecompletionHandler
and is up to the design of what you want to build. – OversightcompletionHandler(false)
... otherwise, it's almost always called with a boolean valuetrue
. – Blanchettetrue
and I have tried passingfalse
and I have tried not even calling the completion handler, and I see no difference whatever. We do perform the selected action, no matter what, and things do not look or behave differently. What I am asking you to do is show that I'm wrong somehow. – Maryrose