为什么我在这个简单的代码中得到了Apple Mach-O错误?

时间:2013-08-30 12:13:53

标签: objective-c xcode uiwebview

我有这个相当简单的代码,但不知怎的,我得到了Apple Mach-O错误。有人能给我一个错误的线索吗?

AvhorViewController.h:

#import <UIKit/UIKit.h>

@interface AvhorViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *WebViewAvhor;

@end

AvhorViewController.m

#import "AvhorViewController.h"

@interface AvhorViewController ()

@end

@implementation AvhorViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"one" ofType:@"htm" inDirectory:@"Avhor"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_WebViewAvhor loadRequest:requestObj];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];

}

@end

我添加了以下框架:

AddressBookUI.framework
MapKit.framework
CoreLocation.framework
UIKit.framework
Foundation.framework
CoreGraphics.framework

错误之处:

  

Ld的   /Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-iphonesimulator/Avhor.app/Avhor   正常的i386       cd / Users / Centurion / Documents / Xcode / Avhor       setenv IPHONEOS_DEPLOYMENT_TARGET 6.1       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.1.sdk   -L /用户/百夫长/库/开发商/ Xcode中/ DerivedData / Avhor-clfeavlkecrxomdmbtwixetebjsa /编译/产品/调试,iphonesimulator   -F /用户/百夫长/库/开发商/ Xcode中/ DerivedData / Avhor-clfeavlkecrxomdmbtwixetebjsa /编译/产品/调试,iphonesimulator   -filelist /Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Intermediates/Avhor.build/Debug-iphonesimulator/Avhor.build/Objects-normal/i386/Avhor.LinkFileList   -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min = 6.1 -framework AddressBookUI -framework MapKit -framework CoreLocation -framework UIKit -framework Foundation-framework CoreGraphics - o /Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-iphonesimulator/Avhor.app/Avhor

     

ld:无法打开输出文件进行写入:   /Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-iphonesimulator/Avhor.app/Avhor,   对于体系结构i386 clang,errno = 21:错误:链接器命令失败   退出代码1(使用-v查看调用)

2 个答案:

答案 0 :(得分:2)

请参阅here了解同一问题。您可以尝试(通常的Xcode步骤来解决问题):

  • 手动删除错误消息中的文件
  • 清洁项目
  • 重新打开Xcode

答案 1 :(得分:-1)

错误是因为我将文件夹命名为保存本地内容与项目名称相同的文件夹。

我做了以下事情:

  • 已删除包含本地内容的文件夹(在Finder中
  • 清理项目
  • 在名称不同的文件夹中添加了文件