2013-03-30 60 views
-1

我有一些加密数据,我想在应用程序启动后解密它。我做这个代码:找不到实例方法'-decrytedWithKey'(将默认值返回为'id')

NSMutableData *FR2ENData=[NSMutableData dataWithContentsOfFile:FR2ENFilePath]; 
     FR2ENData=[FR2ENData decryptedWithKey:@"XXXXXXXX"]; 
     NSString * FR2ENString = [NSString stringWithUTF8String:[FR2ENData bytes]]; 
     NSArray *FR2EN0=[FR2ENString componentsSeparatedByString:@"\n"]; 

而且我得到这个警告信息:

实例方法“-decrytedWithKey”未找到(返回默认tyoe到“身份证”)

哪有我清理它?

感谢提前:)

+2

c#????我想这是Objective-c。 –

+0

@AnoopVaidya昨天我看到一个标签为C++的Objective-C问题... Xcode有点*可以理解,但C#和C++?真? – 2013-03-30 12:13:55

+0

真的很抱歉家伙! – Icarox

回答

3

你缺少的NSDatadecryptedWithKey:方法类别标题。它看起来像您使用的是扩展类defined by the user Karl in the third post on this page(我复制下面的标题):

#import <Foundation/Foundation.h> 

@interface NSData (AES256) 
- (NSData*) encryptedWithKey:(NSData*) key; 
- (NSData*) decryptedWithKey:(NSData*) key; 
@end 

你的代码需要,以避免编译错误导入这个头。您还需要将实现添加到项目中,作为源代码或库,以避免链接错误。

相关问题