Objective c 为什么在设置FSFileOperationClientContext的信息指针时会获得EXEC\u BAD\u访问权限?

Objective c 为什么在设置FSFileOperationClientContext的信息指针时会获得EXEC\u BAD\u访问权限?,objective-c,macos,cocoa,automatic-ref-counting,Objective C,Macos,Cocoa,Automatic Ref Counting,我正在使用FSCopyObjectAsync在Cocoa应用程序中复制文件。问题是,每当我试图设置info字段(类型为void*的对象)时,应用程序就会因为执行错误的访问而崩溃。我不确定我做错了什么 这是我的密码: // Start the async copy. FSFileOperationClientContext *clientContext = NULL; if (spinner != nil) { clientContext->info = (__bridge void

我正在使用
FSCopyObjectAsync
在Cocoa应用程序中复制文件。问题是,每当我试图设置
info
字段(类型为
void*
的对象)时,应用程序就会因为
执行错误的访问而崩溃。我不确定我做错了什么

这是我的密码:

// Start the async copy.
FSFileOperationClientContext *clientContext = NULL;
if (spinner != nil) {
    clientContext->info = (__bridge void *)(spinner); // <- Problem here!
}

status = FSCopyObjectAsync(fileOp,
                           &source,
                           &destination, // Full path to destination dir.
                           CFSTR("boot.iso"), // Copy with the name boot.iso.
                           kFSFileOperationDefaultOptions,
                           copyStatusCallback,
                           0.5, // How often to fire our callback.
                           clientContext); // The progress bar that we want to use to update.

CFRelease(fileOp);
//启动异步复制。
FSFileOperationClientContext*clientContext=NULL;
如果(微调器!=零){

clientContext->info=(uu-bridge-void*)(微调器);//您正在创建一个空指针,但没有分配它,然后尝试引用它。更改代码,以便在堆栈上分配它并传递其地址,如下所示

    // Start the async copy.
FSFileOperationClientContext clientContext;
if (spinner != nil) {
    clientContext.info = (__bridge void *)(spinner);
}

status = FSCopyObjectAsync(fileOp,
                           &source,
                           &destination, // Full path to destination dir.
                           CFSTR("boot.iso"), // Copy with the name boot.iso.
                           kFSFileOperationDefaultOptions,
                           copyStatusCallback,
                           0.5, // How often to fire our callback.
                           &clientContext); // The progress bar that we want to use to update.

CFRelease(fileOp);

失败,错误为
错误:address不包含指向对象文件中某个节的节。
。不同的问题,如果看不到完整的代码就很难判断。您看过使用FSCopyObjectAsync的各种示例代码吗?是的,但它们没有太大的帮助。我找不到任何代码正在执行我尝试执行的操作。虽然在GitHub上,但代码是开源的;下面是相关文件的链接:相关代码比一半多一点。哦,这很简单,我会克隆它,看看会发生什么-我也是Obj-C(更多的是C/C++/Java guy)的新手,所以我不会承诺任何事情:)谢谢。我会保持希望。:)