@property (strong, nonatomic) void(^pickerCompletion)(NSDate *date);
If the property is strong, the compiler automatically copies the block. pickerCompletion has the ownership of the copied block(Heap Block).
@property (weak, nonatomic) void(^pickerCompletion)(NSDate *date);
But if the property is weak, the compiler does nothing, just put the pointer value to the variable. And if the pointer is Stack Block (just ordinary block literal), the pointer value is never zero-filled by ARC. Didn't you get a warning message from the compiler like that?
warning: assigning block literal to a weak property; object will be
released after assignment
Besides there is a race condition.
if (self.pickerCompletion) self.pickerCompletion(self.date);
self.pickerCompletion could be zero-filled before self.pickerCompletion(self.date) after if (self.pickerCompletion) in multithreading environment. Use temporary __strong variable for accessing the weak object safely.
void(^pickerCompletion)(NSDate *date) = self.pickerCompletion;
if (pickerCompletion) pickerCompletion(self.date);
copy, though I think thenonatomicis perfectly fine.Copytells the runtime "This needs to move from the stack to the heap so it can persist past the current stack frame where it was assigned." - Ben Pious