我想集成 flickr api 以通过我的 iphone 应用程序将图像上传到 flickr 站点。我已经从 github 下载了代码 snap&Run。我在我的项目中集成了相同的 SDK 代码。但它在转换为 ARC 时向我显示错误。我有读线问题。这些错误在 OFUtilities.m 文件中
static NSData *OFSha1(NSData *inData)
{
NSMutableData *result = [NSMutableData dataWithLength:CC_SHA1_DIGEST_LENGTH];
CC_SHA1_CTX context;
CC_SHA1_Init(&context);
CC_SHA1_Update(&context, [inData bytes], (CC_LONG)[inData length]);
CC_SHA1_Final([result mutableBytes], &context);
return result;
}
在上述方法中,我收到此错误“调用 CC_SHA1_Final 没有匹配函数”
NSString *OFHMACSha1Base64(NSString *inKey, NSString *inMessage)
{
NSData *keyData = [inKey dataUsingEncoding:NSUTF8StringEncoding];
if ([keyData length] > CC_SHA1_BLOCK_BYTES) {
keyData = OFSha1(keyData);
}
if ([keyData length] < CC_SHA1_BLOCK_BYTES) {
NSUInteger padSize = CC_SHA1_BLOCK_BYTES - [keyData length];
NSMutableData *paddedData = [NSMutableData dataWithData:keyData];
[paddedData appendData:[NSMutableData dataWithLength:padSize]];
keyData = paddedData;
}
NSMutableData *oKeyPad = [NSMutableData dataWithLength:CC_SHA1_BLOCK_BYTES];
NSMutableData *iKeyPad = [NSMutableData dataWithLength:CC_SHA1_BLOCK_BYTES];
const uint8_t *kdPtr = [keyData bytes];
uint8_t *okpPtr = [oKeyPad mutableBytes];
uint8_t *ikpPtr = [iKeyPad mutableBytes];
memset(okpPtr, 0x5c, CC_SHA1_BLOCK_BYTES);
memset(ikpPtr, 0x36, CC_SHA1_BLOCK_BYTES);
NSUInteger i;
for (i = 0; i < CC_SHA1_BLOCK_BYTES; i++) {
okpPtr[i] = okpPtr[i] ^ kdPtr[i];
ikpPtr[i] = ikpPtr[i] ^ kdPtr[i];
}
NSData *msgData = [inMessage dataUsingEncoding:NSUTF8StringEncoding];
NSMutableData *innerData = [NSMutableData dataWithData:iKeyPad];
[innerData appendData:msgData];
NSData *innerDataHashed = OFSha1(innerData);
NSMutableData *outerData = [NSMutableData dataWithData:oKeyPad];
[outerData appendData:innerDataHashed];
NSData *outerHashedData = OFSha1(outerData);
size_t outputLength;
char *outputBuffer = NewBase64Encode([outerHashedData bytes], [outerHashedData length], true, &outputLength);
NSString *result = [[[NSString alloc] initWithBytes:outputBuffer length:outputLength encoding:NSASCIIStringEncoding] autorelease];
free(outputBuffer);
return result;
}
在这里我得到错误是“无法使用 const 值类型的 r 值初始化 'const uint8_t' 类型的变量”
请帮我。先谢谢了。