将我的代码从MacOSX10.11 SDK移植到MacOSX10.12 SDK后,我收到以下错误:
Null传递给需要非空参数的被调用者
这里:
PasteboardResolvePromises(kPasteboardResolveAllPromises)
此处,kPasteboardResolveAllPromises为NULL,这意味着将解析此应用程序当前拥有的所有全局粘贴板资源上的所有承诺。
但是,Apple通过使其需要传递非空参数来更改此API。
您可以查看文档here。
有趣的是,苹果公司不会更新该功能的文档,它仍然会说:
#define kPasteboardResolveAllPromises (PasteboardRef)NULL
/*
* PasteboardResolvePromises()
*
* Summary:
* Resolves promises on the provided local pasteboard reference. If
* multiple local pasteboard references to the same global
* pasteboard resource exist, only those promises made through the
* provided reference are resolved.
*
* Mac OS X threading:
* Not thread safe
*
* Parameters:
*
* inPasteboard:
* The local pasteboard reference for which promises will be
* resolved. Passing kPasteboardResolveAllPromises, or NULL, will
* cause all promises on all global pasteboard resources currently
* owned by this application to be resolved.
*
* Result:
* An operating system result code.
*
* Availability:
* Mac OS X: in version 10.3 and later in ApplicationServices.framework
* CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
* Non-Carbon CFM: not available
*/
extern OSStatus
PasteboardResolvePromises(PasteboardRef inPasteboard) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
我的问题是:我如何进行与
相同的操作PasteboardResolvePromises(kPasteboardResolveAllPromises)