Open GoogleCodeExporter opened 8 years ago
ok i change -(NSString *)encodeBase64ForData in NSData+Base64Additions.m
#define PARTS_LENGTH 512
-(NSString *)encodeBase64ForData
{
NSMutableString *encodedString = nil;
// Make sure this is nul-terminated.
size_t outBufferEstLength = EstimateBas64EncodedDataSize([self length]) + 1;
char *outBuffer = calloc(outBufferEstLength, sizeof(char));
size_t outBufferLength = outBufferEstLength;
if (Base64EncodeData([self bytes], [self length], outBuffer, &outBufferLength, FALSE))
{
encodedString = [NSMutableString stringWithCString:outBuffer encoding:NSASCIIStringEncoding];
//divide string
int length = [encodedString length];
int partsCount = length/PARTS_LENGTH;
for(int i = partsCount; i >= 1; i--)
{
[encodedString insertString:@"\n" atIndex: PARTS_LENGTH*i];
}
}
else
{
[NSException raise:@"NSData+Base64AdditionsException" format:@"Unable to encode data!"];
}
free(outBuffer);
return encodedString;
}
and all good work.
Original comment by LeshikM...@gmail.com
on 23 Apr 2009 at 2:33
Original issue reported on code.google.com by
LeshikM...@gmail.com
on 15 Apr 2009 at 3:38