我正在尝试在 xcode 中构建,但我一直遇到这个问题
No visible @interface for 'NSData' declares the selector 'initWithBase64Encoding:'
和
No visible @interface for 'NSData' declares the selector 'base64Encoding'
我到处都没有看过,但我的问题没有明确的解决方案。这些是给我的问题:
- (NSString*)stringFromImage:(UIImage*)image
{
if(image)
{
UIImage* convertImage = [GameUtility imageWithImage:image scaledToSize:CGSizeMake(80, 80)];
NSData *dataObj = UIImageJPEGRepresentation(convertImage, 30);
return [dataObj base64Encoding];
}
return @"";
}
- (UIImage*)imageFromString:(NSString*)imageString
{
NSData* imageData =[[NSData alloc] initWithBase64Encoding:imageString];
return [UIImage imageWithData:imageData];
}