yourkarma / JWT

A JSON Web Token implementation in Objective-C.
MIT License
350 stars 107 forks source link

Implicit declaration of function 'SecCopyErrorMessageString' is invalid in C99 #202

Open vladarefiev opened 5 years ago

vladarefiev commented 5 years ago

Issue Info

Info Value
Platform Name ios
Xcode Version Xcode 9.0
Deployment target 9.0
Base SDK Latest iOS (iOS 11.0)

Issue Description and Steps

Hi there, I have a problems with building project. Implicit declaration of function 'SecCopyErrorMessageString' is invalid in C99 in the JWTCryptoSecurity+ErrorHandling.m file.

if (@available(iOS 11.3, *)) {
        NSString *message = (NSString *)CFBridgingRelease(SecCopyErrorMessageString(status, NULL)) ?: @"Unknown error message";
        return [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:@{NSLocalizedDescriptionKey : message}];
    }
lolgear commented 5 years ago

@vladarefiev Hi! Please, post Deployment target and Base SDK versions.

vladarefiev commented 5 years ago

@lolgear added to issue description.

lolgear commented 5 years ago

@vladarefiev Weird. How do you compile this project? Please, also post commit hash.

vladarefiev commented 5 years ago

@lolgear I have just checked project out to clear directory, installed all deps. Then I had You should run pod update CodePush to apply changes you've made. After that my Podfile.lock has been changed.

-  - CodePush (5.4.0):
+  - CodePush (5.4.1):

-  - JWT (3.0.0-beta.8):
+  - JWT (3.0.0-beta.11):

Product -> Build -> Build failed

image

lolgear commented 5 years ago

@vladarefiev Fixing problems in Apple ecosystem.

Xcode rules

  1. Product -> Build -> Clean Build Folder.
  2. Relaunch Xcode.
  3. Update Xcode from AppStore/Developer Beta.

MacOS rules

  1. Restart MacOS.
  2. Reset PRAM.
  3. Reset SMC.

iPhone rules

  1. Buy new.
lolgear commented 5 years ago

@vladarefiev Did you solve it by "Clean" action in Xcode or by removing DerivedData folder?

fluiddot commented 5 years ago

any update on this? It's happening to me too.

lolgear commented 5 years ago

@fluiddot Hi! Could you attach example project and all necessary tools versions. ( Xcode, deployment target etc. )

agonbina commented 5 years ago

So I ran into the same issue and I solved it by upgrading xcode to 9.4.1 (previously I had 9.2.x).

I only figured this out because I had selected the 9.4.1 version of xcode to build in my appcenter settings, where the building was working perfectly fine, whereas on my local machine with an older version of xcode the build was failing for this exact same reason.

hellChine commented 5 years ago

image this API just active on iphone_11.3 or later.

sryze commented 3 years ago

Same error on Xcode 9.2 (I'm using an old Sierra Hackintosh, can't update it).

I think it needs to be replaced this with a compile-time check with #if ...#endif` so that it actually compiles with older SDKs, .e.g

    #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110300)
        NSString *message = (NSString *)CFBridgingRelease(SecCopyErrorMessageString(status, NULL)) ?: @"Unknown error message";
        return [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:@{NSLocalizedDescriptionKey : message}];
    #endif
    return [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];

BTW my SDK version is 11.2.