編集 私の問題は、クラスをプロジェクトにリンクしていないことでした。
基本的に端末アプリであるアプリに取り組んでいます。ビルドしようとすると、ビルドエラーが発生します。
Ld /Users/evanstoddard/Library/Developer/Xcode/DerivedData/Highjack-anstcjvykrnniwbltvijvyvexirq/Build/Products/Debug-iphonesimulator/Highjack.app/Highjack normal i386
cd /Users/evanstoddard/Desktop/Highjack
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv 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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/evanstoddard/Library/Developer/Xcode/DerivedData/Highjack-anstcjvykrnniwbltvijvyvexirq/Build/Products/Debug-iphonesimulator -F/Users/evanstoddard/Library/Developer/Xcode/DerivedData/Highjack-anstcjvykrnniwbltvijvyvexirq/Build/Products/Debug-iphonesimulator -filelist /Users/evanstoddard/Library/Developer/Xcode/DerivedData/Highjack-anstcjvykrnniwbltvijvyvexirq/Build/Intermediates/Highjack.build/Debug-iphonesimulator/Highjack.build/Objects-normal/i386/Highjack.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/evanstoddard/Library/Developer/Xcode/DerivedData/Highjack-anstcjvykrnniwbltvijvyvexirq/Build/Products/Debug-iphonesimulator/Highjack.app/Highjack
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_XXFdHijacker", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ここに私の実装ファイルがあります:
//
// ViewController.m
// My Utility 2
//
// Created by Evan Stoddard on 2/6/13.
// Copyright (c) 2013 Evan Stoddard. All rights reserved.
//
#import "ViewController.h"
#import "XXFdHijacker.h"
@interface ViewController () <XXFdHijackerDelegate>
@property (weak, nonatomic) IBOutlet UITextView *loggingView;
@property (strong, nonatomic) XXFdHijacker *stdoutHijacker;
@property (strong, nonatomic) XXFdHijacker *stderrHijacker;
@property (strong, nonatomic) NSMutableString *contents;
@end // extension
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Hijack standard out.
self.stdoutHijacker = [XXFdHijacker hijackerWithFd: fileno(stdout)];
setbuf (stdout, NULL);
self.stdoutHijacker.delegate = self;
[self.stdoutHijacker startHijacking];
[self.stdoutHijacker startReplicating];
// Hijack standard error
self.stderrHijacker = [XXFdHijacker hijackerWithFd: fileno(stderr)];
setbuf (stderr, NULL);
self.stderrHijacker.delegate = self;
[self.stderrHijacker startHijacking];
[self.stderrHijacker startReplicating];
self.contents = [NSMutableString string];
NSLog (@"All Kids Love Log");
} // viewDidLoad
- (void) scrollToEnd {
NSRange range = NSMakeRange (self.contents.length, 0);
[self.loggingView scrollRangeToVisible: range];
} // scrollToEnd
- (void) hijacker: (XXFdHijacker *) hijacker gotText: (NSString *) text {
if (hijacker == self.stdoutHijacker) [self.contents appendString: @"stdout: "];
if (hijacker == self.stderrHijacker) [self.contents appendString: @"stderr: "];
[self.contents appendString: text];
self.loggingView.text = self.contents;
[self scrollToEnd];
} // hijacker
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
もっと見る必要がある場合は、私の xcode プロジェクトを送ります。