objective-c - 为什么在这个简单的代码中会出现 Apple Mach-O 错误?

标签 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 normal 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/Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-iphonesimulator -F/Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-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: can't open output file for writing: /Users/Centurion/Library/Developer/Xcode/DerivedData/Avhor-clfeavlkecrxomdmbtwixetebjsa/Build/Products/Debug-iphonesimulator/Avhor.app/Avhor, errno=21 for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

最佳答案

参见 here对于同样的问题。您可以尝试的方法(解决问题的常用 Xcode 步骤):

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

关于objective-c - 为什么在这个简单的代码中会出现 Apple Mach-O 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18532652/

相关文章:

iphone - UIWebview 手势 iOS

ios - 使用 UIWebView 上传照片

ios - 如何从网络服务加载数组?

ios - 处理 UITableViewcell subview 的 Action (事件)的正确方法是什么?

c - 获取 "Message from debugger: Error 1"- 对于简单项目(在 Xcode 11.0 11A420a 中)

ios - 如何根据我的方案更改 .plist 条目?

ios - 带有@property 的简单类示例不允许属性检索

iphone - 当 css 作为本地资源包含在 iPhone 上的 UIWebView 中时,jQuery Mobile Sprite 不显示

iphone - 防止在 iOS SDK 中卸载 View ?

objective-c - 我可以使用 PhoneGap 调用自定义 Objective C 类上的方法吗?