繁体   English   中英

Apple Mach-O链接器错误在DetailViewController

[英]Apple Mach-O Linker Error on DetailViewController

我添加了一个视图控制器,它是表的详细视图,并且不断出现Apple Mach-O Linker错误,但似乎无法弄清楚为什么。 这是我的.h文件:

#import <UIKit/UIKit.h>
#import "EmailCell.h"
#import "MasterViewController.h"

@interface DetailViewController : MasterViewController <UITableViewDataSource, UITableViewDelegate,         ZKRevealingTableViewCellDelegate, UIAlertViewDelegate> {
NSDictionary *newsArticle;

IBOutlet UILabel *titleLabel;
IBOutlet UILabel *timeLabel;
IBOutlet UITextView *descTextView;



}

@property (nonatomic, copy) NSDictionary *newsArticle;

@property (strong, nonatomic) IBOutlet UIButton *callHotline;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *postToTwitter;

@property (strong, nonatomic) IBOutlet UITableView *tableView;

@end

和我的.m文件:

#import "ADVTheme.h"
#import "DataSource.h"
#import "AppDelegate.h"
#import "DetailViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "Utils.h"
#import "Social/Social.h"
#import "Flurry.h"


@interface DetailViewController () {
NSIndexPath *currentIndex;
}

 @property (strong, nonatomic) NSArray *items;
 @property (strong, nonatomic) ZKRevealingTableViewCell *currentlyRevealedCell;

@end




 @implementation DetailViewController
 @synthesize newsArticle;

 #pragma mark - View lifecycle

 - (void)viewDidLoad {
[super viewDidLoad];

if(![Utils isVersion6AndBelow])
    self.navigationController.navigationBar.translucent = NO;

 [ADVThemeManager customizeView:self.view];


UILabel *titleLabel = [[UILabel alloc] init];

titleLabel.text = [newsArticle objectForKey:@"title"];
timeLabel.text = [newsArticle objectForKey:@"date_string"];

descTextView.text = [newsArticle objectForKey:@"article"];



titleLabel.text = @"AEVIDUM";
titleLabel.textColor = [UIColor whiteColor];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.font = [UIFont fontWithName:@"ProximaNova-Bold" size:17];
[titleLabel sizeToFit];
self.navigationItem.titleView = titleLabel;



 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    if ([[NSUserDefaults standardUserDefaults] integerForKey:@"NavigationType"] ==     ADVNavigationTypeMenu) {
        UIButton *menuButton = [UIButton buttonWithType:UIButtonTypeCustom];
        menuButton.frame = CGRectMake(0, 0, 40, 30);
        [menuButton setImage:[UIImage imageNamed:@"navigation-btn-menu"] forState:UIControlStateNormal];
        [menuButton addTarget:self action:@selector(showMenu:) forControlEvents:UIControlEventTouchUpInside];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:menuButton];
    } else {
        self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 5)];
    }
}


self.tableView.tableHeaderView.backgroundColor = [UIColor colorWithRed:0.27f green:0.29f blue:0.31f alpha:1.00f];

NSString *filterTitle = [NSString stringWithFormat:@"Showing %@ of %@", @10, @52];
UILabel *labelFilter = (UILabel *)[self.tableView.tableHeaderView viewWithTag:1];

const CGFloat fontSize = 14;
UIFont *boldFont = [UIFont fontWithName:@"ProximaNova-Semibold" size:fontSize];
UIFont *regularFont = [UIFont fontWithName:@"ProximaNova-Regular" size:fontSize];
UIColor *regularColor = [UIColor whiteColor];
UIColor *boldColor = [UIColor whiteColor];
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                       regularFont, NSFontAttributeName,
                       regularColor, NSForegroundColorAttributeName, nil];
NSDictionary *subAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
                          boldFont, NSFontAttributeName,
                          boldColor, NSForegroundColorAttributeName, nil];
const NSRange range = NSMakeRange(8, 2);

// Create the attributed string (text + attributes)
NSMutableAttributedString *attributedText =
[[NSMutableAttributedString alloc] initWithString:filterTitle
                                       attributes:attrs];
[attributedText setAttributes:subAttrs range:range];

const NSRange range1 = NSMakeRange(13, 3);
[attributedText setAttributes:subAttrs range:range1];

[labelFilter setAttributedText:attributedText];

UIButton *btnFilter = (UIButton *)[self.tableView.tableHeaderView viewWithTag:2];
btnFilter.layer.cornerRadius = 2;
btnFilter.titleLabel.font = [UIFont fontWithName:@"ProximaNova-Bold" size:10];
btnFilter.backgroundColor = [UIColor colorWithRed:0.17f green:0.18f blue:0.20f alpha:1.00f];


 }

 - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

self.items = [DataSource timeline];
[self.tableView reloadData];
 }

 - (void)viewDidUnload {
[super viewDidUnload];

 }


 #pragma mark - Actions

 - (void)showMenu:(id)sender {
[[AppDelegate sharedDelegate] togglePaperFold:sender];
 }






#pragma mark - UITableView datasource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
 }

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.items.count;
 }

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath      *)indexPath {
NSString *CellIdentifier = @"StoreCell";
EmailCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];


NSDictionary *item = self.items[indexPath.row];
cell.data = item;

cell.delegate       = self;
cell.backView.frame = CGRectMake(0, 0, 190, [self tableView:_tableView      heightForRowAtIndexPath:nil]);
cell.backView.backgroundColor = [UIColor colorWithRed:0.91f green:0.38f blue:0.39f alpha:1.00f];
cell.direction = ZKRevealingTableViewCellDirectionRight;

for(UIView *cellItem in cell.backView.subviews) {
    [cellItem removeFromSuperview];
 }


 return cell;
 }

 #pragma mark - Table view delegate

 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 79;
 }

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {    
[tableView deselectRowAtIndexPath:indexPath animated:YES];

currentIndex = indexPath;
[self performSegueWithIdentifier:@"showDetail" sender:self];
 }

 #pragma mark - ZKRevealingTableViewCellDelegate

 - (BOOL)cellShouldReveal:(ZKRevealingTableViewCell *)cell {
return YES;
 }

 - (void)cellDidReveal:(EmailCell *)cell {
NSLog(@"Revealed Cell with name: %@", cell.lblTitle.text);
self.currentlyRevealedCell = cell;
 }

 - (void)cellDidBeginPan:(ZKRevealingTableViewCell *)cell {
if (cell != self.currentlyRevealedCell)
    self.currentlyRevealedCell = nil;
 }


 #pragma mark - Segue


 //Action Button
 - (IBAction)postToTwitter:(id)sender {
 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Actions" message:@""
                                               delegate:self cancelButtonTitle:@"Close"
                                      otherButtonTitles:@"Tweet #Aevidum", @"Call National      Helpline", @"Contact Aevidum", nil];
[alert show];

 }

 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 {
 if (buttonIndex == 0)
 {
    //Neither


}
if (buttonIndex == 1)
{
    //Tweet
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                                composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"#aevidum"];
        [self presentViewController:tweetSheet animated:YES completion:nil];
       [Flurry logEvent:@"User Launched Tweet Sheet On Detail VC"];
    }

}
if (buttonIndex == 2)
{

    //Call
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:18002738255"]];
   [Flurry logEvent:@"User Called Hotline On Detail VC"];
}
if (buttonIndex == 3)
{
    //Contact

    NSURL* mailURL = [NSURL URLWithString: @"mailto:bporter@aevidum.org?&subject=Aevidum%20App%20Contact&body="];
    [[UIApplication sharedApplication] openURL: mailURL];
    [Flurry logEvent:@"User Tapped Contact Aevidum On Detail VC"];


}
 }

 @end

任何帮助将不胜感激。

更新:这是我的错误消息:

ld: warning: directory not found for option '-L/Users/Ben/Documents/AevidumApp/flattened-d/sample-project/Flattened/Flurry'
ld: warning: directory not found for option '-LiPhone'
ld: warning: directory not found for option '-LSDK'
ld: warning: directory not found for option '-LviPhone'
ld: warning: directory not found for option '-L5.4.0/Flurry-iOS-5.4.0/Flurry'
duplicate symbol _OBJC_CLASS_$_DetailViewController in:
    /Users/Ben/Library/Developer/Xcode/DerivedData/Aevidum-bwoaadpgrdrtbldbecytkhjhqxhb/Build/Intermediates/Aevidum.build/Debug-iphonesimulator/Aevidum.build/Objects-normal/x86_64/DetailViewController-1A6DD9FBD478005A.o
    /Users/Ben/Library/Developer/Xcode/DerivedData/Aevidum-bwoaadpgrdrtbldbecytkhjhqxhb/Build/Intermediates/Aevidum.build/Debug-iphonesimulator/Aevidum.build/Objects-normal/x86_64/DetailViewController-ABC328ACC6891270.o
duplicate symbol _OBJC_METACLASS_$_DetailViewController in:
    /Users/Ben/Library/Developer/Xcode/DerivedData/Aevidum-bwoaadpgrdrtbldbecytkhjhqxhb/Build/Intermediates/Aevidum.build/Debug-iphonesimulator/Aevidum.build/Objects-normal/x86_64/DetailViewController-1A6DD9FBD478005A.o
    /Users/Ben/Library/Developer/Xcode/DerivedData/Aevidum-bwoaadpgrdrtbldbecytkhjhqxhb/Build/Intermediates/Aevidum.build/Debug-iphonesimulator/Aevidum.build/Objects-normal/x86_64/DetailViewController-ABC328ACC6891270.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的对象中有另一个名为DetailViewController的文件,该文件引发错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM