RNCryptor: Conflicting types error in Xcode 9

Seeing this error after trying to build on Xcode 9. Has anyone else had an issue like this?

RNCryptor.m:61:12: Conflicting types for 'SecRandomCopyBytes'

screen shot 2017-07-21 at 3 55 53 pm

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Replacing that line with this block seems to be a decent solution that will compile properly in Xcode 8 and 9:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, void *bytes) __attribute__((weak_import));
#else
extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, uint8_t *bytes) __attribute__((weak_import));
#endif

@gregggreg That sounds like a reasonable solution. Sorry for the delay getting something out; I’ll try this and push a new version this week.

iOS 11 changed the signature of that method. RNCryptor devs will need to change it in order to be compatible with the new signature

The function signature of SecRandomCopyBytes has changed from: -extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, uint8_t *bytes) attribute((weak_import));

to: +extern int SecRandomCopyBytes(SecRandomRef rnd, size_t count, void *bytes) attribute((weak_import));

What version of RNCryptor are you using? This repository is Swift-only now. The ObjC version was moved to RNCryptor-objc. The current version of RNCryptor-objc shouldn’t have this problem (it checks whether you’re OS X 10.6 or earlier).

See also https://github.com/RNCryptor/RNCryptor-objc/issues/19