本文介绍了NSData + Base64.m中的XCode标记类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误如下图所示
- (id) initWithBase64EncodedString:(NSString *) string {
NSMutableData *mutableData = nil;
if( string ) {
unsigned long ixtext = 0;
unsigned long lentext = 0;
unsigned char ch = 0;
unsigned char inbuf[4], outbuf[4];
short i = 0, ixinbuf = 0;
BOOL flignore = NO;
BOOL flendtext = NO;
NSData *base64Data = nil;
const unsigned char *base64Bytes = nil;
// Convert the string to ASCII data.
base64Data = [string dataUsingEncoding:NSASCIIStringEncoding];
base64Bytes = [base64Data bytes];
mutableData = [NSMutableData dataWithCapacity:[base64Data length]];
lentext = [base64Data length];
}
我也进入了另一个名为
- (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength {
**const unsigned char *bytes = [self bytes];**
NSMutableString *result = [NSMutableString stringWithCapacity:[self length]];
}
推荐答案
您可以通过强制类型转换来解决该错误...但是不确定数据是否在同一格式中.
You can resolve that error by type casting...but not sure data is in same formate..
base64Bytes = (const unsigned char*)[base64Data bytes];
这篇关于NSData + Base64.m中的XCode标记类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!