Skip to content

Xcode 6.3 reports semantic issues #76

@NikolayEntin

Description

@NikolayEntin

/.../RHAddressBook/RHAddressBookSharedServices.m:122:13: Comparison of function 'ABAddressBookCreateWithOptions' not equal to a null pointer is always true

this comes from such blocks as:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
        if (ABAddressBookCreateWithOptions != NULL){
...
#endif

it offers Fix-It solution

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
        if (&ABAddressBookCreateWithOptions != NULL){
...
#endif

I.e. to use reference to the method.

(and there are about 10-15 issues like that)

Actually I'm quite confused, I think XCode fix is not correct:
Thise comparisons are made to check availability of the functions, so it's correct that in target environment (iOS6+), this will be always true (methods presented). But it might be different on different environment (though still during compilation it will probably generate the same optimization - always false).
But I don't want to have open issues in my project, using of '&' in front of the method name still will work on iOS6+ - it refers to allocation of the method in method allocation table (or whatever) and it won't be NULL. But I have no idea if this will be issue (not for me) on iOS < 6.

Anyone advice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions