[英]Passing BOOL * to ALAssetsLibrary
Hi I need to pass a BOOL to the 嗨,我需要将BOOL传递给
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. 将该值设置为YES即可停止枚举。
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? 所以我的问题是如何传递布尔值作为stop参数的指针?
Any help would be much appreciated. 任何帮助将非常感激。
As you said, stop
is a pointer to a BOOL
value. 如您所说, stop
是一个指向BOOL
值的指针。 To assign a value to the memory location stop
is pointing at, you have to dereference the pointer with the *
operator. 要将值分配给stop
所指向的内存位置,必须使用*
运算符取消引用指针。 Like this: 像这样:
*stop = YES;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.