I have to use some private functions, like:

SCDynamicStoreRef
SCDynamicStoreCreate            (
                    CFAllocatorRef          allocator,
                    CFStringRef         name,
                    SCDynamicStoreCallBack      callout,
                    SCDynamicStoreContext       *context
                    )               __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);

By default they are not allowed for iphone, so I've changed declaration of them in my .m file. But now it shows "Availability does not match previous declaration" warning. How to suppress this warning?

enter image description here

有帮助吗?

解决方案

With the usual disclaimer that using private APIs might cause your app to be rejected: You can suppress the warning with

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wavailability"
…
#pragma clang diagnostic pop

It might also cause crashes or other failures if that function is present in the iOS frameworks, but with different parameters.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top