Passing BOOL * to ALAssetsLibrary
Hi I need to pass a BOOL to the
ALAssetsLibrary
- (void)enumerateGroupsWithTypes:(ALAssetsGroupType)types usingBlock:(ALAssetsLibraryGroupsEnumerationResultsBlock)enumerationBlock failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock
enumeration block it has the following signature.
^( ALAssetsGroup *group, BOOL *stop )
and the documentation says:
Stop:: A pointer to a boolean value; set the value to YES to stop enumeration.
However if I try setting the value to
stop = YES
I get the following warning and the enumeration just continues.
Initialization makes pointer from integer without cast
So my question is how do i pass a boolean as a pointer to the stop parameter?
Any help w开发者_如何学Could be much appreciated.
As you said, stop
is a pointer to a BOOL
value. To assign a value to the memory location stop
is pointing at, you have to dereference the pointer with the *
operator. Like this:
*stop = YES;
精彩评论