mercredi 3 décembre 2014

iOS app crashing after upgrading to Xcode 6 (Apple LLVM 6 vs 5.1)

I've recently updated my xcode version from 5.1 to 6. This has caused some issues. My app still builds but it crashes as soon as I try to execute the following code with a exc_bad_access error:



UniqueIVFromServer = [NSString stringWithFormat:@"%@", document[@"logon"][@"logondata"]];
CurrentIV = UniqueIVFromServer;
NSString * PreApresData = [NSString stringWithFormat:@"%@", document[@"logon"][@"apresdata"]];

uint16_t initialisationVector[16];
for(int c = 0; c < 16; c++)
initialisationVector[c] = arc4random();

Byte randomDataHolder;
Byte *randomData = &randomDataHolder;
for (int i = 0; i < 16; i++)
{
randomData[i * 2] = (initialisationVector[i] >> 8);
randomData[(i * 2) + 1] = (initialisationVector[i] & 0xFF);
}

NSData * ApresDataData = [[NSData alloc] initWithBytes:randomData length:16];
NSString * ApresDataEncoded = [ApresDataData base64EncodedStringWithOptions:0];


The line it fails on seems to change randomly, but it always breaks somewhere around here. If I compile it in xcode 5 with Apple LLVM 5.1 I have no problems.


Does anybody have any idea what could be causing this? I really don't know where to begin debugging it. I've tried moving the code into a completely new project and it made no difference. I really don't want to have to downgrade the compiler every time I upgrade xcode, nor do I wish to have to keep running a really outdated version.


Thanks!




Aucun commentaire:

Enregistrer un commentaire