Reputation: 2026
I'm fairly new to Objective-C and I'm running into a problem.
I need to pass some information from one viewcontroller to another. I've tried a number of methods and either get build error or don't make enough sense.
Here is what I have so far.
In the second view controllers h file:
@property (nonatomic) NSString *OwnerID;
The data should go into this property.
In the first view controllers m file:
MoreByUserViewController *moreimg =[[MoreByUserViewController alloc] init];
moreimg.OwnerID = ImageOener;
I think this isn't correct but don't know what else to write.
The clang error I get:
duplicate symbol _m_PageCounter in:
/Users/ianspence/Library/Developer/Xcode/DerivedData/Pickr-dohtanjxfozprjbuwlphjbhvxttm/Build/Intermediates/Pickr.build/Debug-iphonesimulator/Pickr.build/Objects-normal/i386/PKRViewController.o
/Users/ianspence/Library/Developer/Xcode/DerivedData/Pickr-dohtanjxfozprjbuwlphjbhvxttm/Build/Intermediates/Pickr.build/Debug-iphonesimulator/Pickr.build/Objects-normal/i386/MoreByUserViewController.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Upvotes: 0
Views: 194
Reputation: 22042
Your problem is something else, now you are getting error for _m_PageCounter. I think twice you put m_PageCounter or used same variable in two different headers..
@interface MoreByUserViewController : UIViewController
{
NSString *mOwnerID;
}
@property(nonatomic, retain) NSString *OwnerID;
-(id)initWithID:(NSString*)inId;
@end
@implementation MoreByUserViewController
@synthesize OwnerID = mOwnerID;
-(id)initWithID:(NSString*)inId
{
if(self = [super init])
{
self.OwnerID = inId;
}
return self;
}
@end
//Somewhere else in code
MoreByUserViewController *moreimg =[[MoreByUserViewController alloc] initWithID:@"AnyIdOnUrWish"];
Upvotes: 0
Reputation: 84328
duplicate symbol _m_PageCounter
means you have a constant or variable or function named m_PageCounter
defined in two places. Specifically, in PKRViewController.m and MoreByUserViewController.m.
Your options:
static
so they won't be visible outside of that source file.Upvotes: 0