o linker error (encryption app)

I have a basic encryption project in Xcode and keep getting an error. Here is my viewcontroller.m file

////////////////////////////////////////////////////

Here are the errors

first two:

Ld /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app/£ncryptor normal x86_64
    cd "/Volumes/Ellek/Xcode/£ncryptor"
    export IPHONEOS_DEPLOYMENT_TARGET=7.1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/system -F/Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator -filelist /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Intermediates/£ncryptor.build/Debug-iphonesimulator/£ncryptor.build/Objects-normal/x86_64/£ncryptor.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework QuartzCore -framework CoreGraphics -framework UIKit -Xlinker -dependency_info -Xlinker /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Intermediates/£ncryptor.build/Debug-iphonesimulator/£ncryptor.build/Objects-normal/x86_64/£ncryptor_dependency_info.dat -o /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app/£ncryptor

Undefined symbols for architecture x86_64:
  "_password", referenced from:
      -[ZAViewController decrypt:] in ZAViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Last Error:

GenerateDSYMFile /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app.dSYM /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app/£ncryptor
    cd "/Volumes/Ellek/Xcode/£ncryptor"
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app/£ncryptor -o /Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app.dSYM

error: unable to open executable '/Users/ellek/Library/Developer/Xcode/DerivedData/£ncryptor-hfcpwsbibblkliafeasjiugwqzuy/Build/Products/Debug-iphonesimulator/£ncryptor.app/£ncryptor'

////////////////////////////////////////////////////

Here is the .h file

#import <UIKit/UIKit.h>
#import "NSData-AES.h"
#import "Base64.h"
#import <QuartzCore/QuartzCore.h>
#import <CoreGraphics/CoreGraphics.h>

@interface ZAViewController : UIViewController{

 //   NSString *decryptedStr;
   // NSString *customKey;
   // NSString *password;
    UITextField *customKey;
   // NSString *customKeyString;
}

//encrypt
@property (strong, nonatomic) IBOutlet UITextView *textFieldEncrypt;
@property (strong, nonatomic) IBOutlet UILabel *encryptedLabel;
- (IBAction)encrypt:(UIButton *)sender;
//decrypt
@property (strong, nonatomic) IBOutlet UITextView *textFieldDecrypt;
@property (strong, nonatomic) IBOutlet UILabel *decryptLabel;

@property (strong, nonatomic) IBOutlet UITextField *customKey;
//@property (strong, nonatomic) IBOutlet NSString *customKeyString;

- (IBAction)decrypt:(UIButton *)sender;
- (IBAction)options:(UIButton *)sender;

@end

////////////////////////////////////////////////////

.M File

Top part of .m file

#import "ZAViewController.h"

@interface ZAViewController ()

@end
@implementation ZAViewController

extern NSString *password;

@synthesize customKey;

First IBAction:

-(IBAction)decrypt:(UIButton *)sender {

//decrypt string

[self.textFieldDecrypt resignFirstResponder]; NSString *b64EncStr = self.textFieldDecrypt.text;

NSData *b64DecData = [Base64 decode:b64EncStr];

NSData *decryptedData = [b64DecData AESDecryptWithPassphrase:password];

NSString* decryptedStr = [[NSString alloc] initWithData:decryptedData

encoding:NSASCIIStringEncoding];

self.decryptLabel.text = decryptedStr;

[self.textFieldDecrypt resignFirstResponder];

}

Next IBAction:

-(IBAction)encrypt:(UIButton *)sender {

    NSString *password = nil;

    NSString *customKeyString = self.customKey.text;

    if ([customKeyString length] == 0) {
        password = @"M1Jzqn8sDNJDp2rjqj6ECqPozCUZXsE";
    }

    if ([customKeyString length] != 0) {
        password = customKeyString;
    }

    /*
     if ([customKeyString length] == 0) {
     NSString *password = @"M1Jzqn8sDNJDp2rjqj6ECqPozCUZXsE";


     }

     if ([customKeyString length] != 0) {
     NSString *password = customKeyString;
     }*/

    [self.textFieldEncrypt resignFirstResponder];

    NSString *str = self.textFieldEncrypt.text; // It does not work with UTF8 like @"こんにちは世界"

    NSLog(@"encrypting string = %@",str);

    NSData *data = [str dataUsingEncoding: NSASCIIStringEncoding];
    NSData *encryptedData = [data AESEncryptWithPassphrase:password];

    [Base64 initialize];
    NSString *b64EncStr = [Base64 encode:encryptedData];

    NSLog(@"Base 64 encoded = %@",b64EncStr);

    self.encryptedLabel.text = b64EncStr;

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = b64EncStr;

    NSString* messageString = [NSString stringWithFormat: @"The encrypted text (%@) has been copied to the clipboard", b64EncStr];

    UIAlertView *copyTHAT = [[[UIAlertView alloc] initWithTitle:@"Copy Successful"
                                                      message:messageString
                                                    delegate:self
                                           cancelButtonTitle:@"Ok"
                                           otherButtonTitles:nil] autorelease];

    [copyTHAT show];


}

IBAction 3:

- (IBAction)options:(UIButton *)sender{

    if ((customKey.enabled = YES)) {
        customKey.enabled = NO;
    }

    if ((customKey.enabled = NO)) {
        customKey.enabled = YES;
    }

}
链接地址: http://www.djcxy.com/p/68336.html

上一篇: initWithData返回(null)

下一篇: o链接器错误(加密应用程序)