可变的难以理解的问题

时间:2014-02-20 19:31:34

标签: ios url advertisement-server

很抱歉这个奇怪的标题,不知道还能写什么。

我正在正确记录变量,但是当我尝试在命令中使用时,返回null:

- (void)requestAdWithURL:(NSURL *)URL
{
    AdSettingsTVC *settings = [[AdSettingsTVC alloc] init];
    NSString *server = [settings retrieveServerName:settings.serverName];
    ANLogDebug(@"The actual server is %@", server);
    self.URL = URL ? URL : [self adURLWithBaseURLString:[NSString stringWithFormat:@"http://%@", server]];
}

控制台返回

  

"实际的服务器是服务器1"

但是我返回的URL(null)

奇怪的是,如果我手动创建变量,如

NSString *server = @"asdf";

网址正确返回asdf

有什么问题?

非常感谢你的时间

编辑:" self.URL =网址是什么? URL:[self adURLWithBaseURLString:[NSString stringWithFormat:@" htp://%@",server]];"调用主机名http://servidor1.mob/parameters

- (NSURL *)adURLWithBaseURLString:(NSString *)urlString {
    urlString = [urlString stringByAppendingString:[self placementIdParameter]];
    urlString = [urlString stringByAppendingString:ANUdidParameter()];
    urlString = [urlString stringByAppendingString:[self dontTrackEnabledParameter]];
    urlString = [urlString stringByAppendingString:[self deviceMakeParameter]];
    urlString = [urlString stringByAppendingString:[self deviceModelParameter]];
    urlString = [urlString stringByAppendingString:[self carrierMccMncParameters]];
    urlString = [urlString stringByAppendingString:[self applicationIdParameter]];
    urlString = [urlString stringByAppendingString:[self firstLaunchParameter]];

    if ([self.delegate respondsToSelector:@selector(extraParametersForAdFetcher:)]) {
        NSArray *extraParameters = [self.delegate extraParametersForAdFetcher:self];

        for (NSString *param in extraParameters) {
            urlString = [urlString stringByAppendingString:param];
        }
    }

    return [NSURL URLWithString:urlString];
}

我不知道它是否会发生任何变化,但adURLWithBaseURLString在void中被调用,但问题不应该在url函数中

0 个答案:

没有答案