2
Я добавил контроллер представления, который является подробным видом таблицы, и я продолжаю получать ошибку Apple Mach-O Linker, но я не могу понять, почему. Вот мой .h файл:Ошибка Apple Mach-O Linker на DetailViewController
#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:[email protected]?&subject=Aevidum%20App%20Contact&body="];
[[UIApplication sharedApplication] openURL: mailURL];
[Flurry logEvent:@"User Tapped Contact Aevidum On Detail VC"];
}
}
@end
Любая помощь будет принята с благодарностью.
Update: вот мои сообщения об ошибках:
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)
Вы должны вставить полную ошибку, которую вы получаете – Puran
Имейте импортированную структуру учетных записей .. Я думаю, что ошибка связана с не импортированием необходимых фреймворков. Как проверить это ... – Vidhyanand
Добавление структуры учетных записей не работает, я добавил сообщения об ошибках в исходный вопрос –