【问题标题】:memory leaks this code内存泄漏此代码
【发布时间】:2011-01-12 07:36:31
【问题描述】:
htmPath = [[NSBundle mainBundle] pathForResource:@"barcode" ofType:@"html"];
params = [[NSString alloc] initWithFormat:@"?data=%@",numberTextField.text];
fileURL = [NSURL URLWithString:[[[NSURL fileURLWithPath:htmPath] absoluteString] stringByAppendingString:params]];

[self.barView loadRequest:[NSURLRequest requestWithURL:fileURL]];

////htmpath,params 是字符串。

///fileurl 是 nsurl,在此我调用为结果附加两个字符串。 ///numberTextField.text 是将使用此 html 以获得更多功能的文本字段。

【问题讨论】:

    标签: iphone ipod-touch


    【解决方案1】:

    你已经分配了“参数”并且没有释放它。

    params = [[NSString alloc] initWithFormat:@"?data=%@",numberTextField.text];
    

    你应该释放每个分配的对象。

    [params release];
    

    【讨论】:

      猜你喜欢
      • 2013-08-18
      • 1970-01-01
      • 2012-01-18
      • 2016-02-04
      • 1970-01-01
      • 2014-07-10
      • 2017-12-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多