检索变量并构建URL

时间:2014-03-18 18:43:30

标签: objective-c variables uitextfield

我正在制作一个广告应用程序,它可以调用不同的服务器,大小,样式。 我试图从服务器上调用某个广告的ID(例如:AD41A),但我无法成功。

AdSettingsTVC.h

@property (weak, nonatomic) IBOutlet UITextField *spaceIdTextField;
@property (weak, nonatomic) NSString *spaceId;

-(IBAction)getSpaceId:(UITextField *)sender;
-(NSString*)retrieveSpaceId:(NSString *)sender;

AdSettingTVC.m

- (IBAction)getSpaceId:(UITextField *)sender{

    self.spaceId = self.spaceIdTextField.text;   
}

-(NSString*)retrieveSpaceId:(NSString *)sender{
    [self getSpaceId:self.spaceIdTextField];
    return self.spaceId ? self.spaceId : @"**ANYTHING**";
}

AnAdFetcher.m

- (NSURL *)adURLWithBaseURLString:(NSString *)urlString {

    AdSettingsTVC *settings = [[AdSettingsTVC alloc] init];

    NSString *sId = [settings retrieveSpaceId:settings.spaceId];

    NSString *spaceId = sId;

    ANLogDebug(@"The spaceId is: %@", spaceId);

    urlString = [urlString stringByAppendingString: spaceId];

...}

问题是 AnAdFetcher.m 中的变量是= ANYTHING ,并且不等于文本域文本

我做错了什么?

非常感谢

0 个答案:

没有答案