Iphone 仅在设备测试时显示内存泄漏。Do';我不知道为什么。?
大家好 在我的iPhone应用程序中,当我在显示这些错误的设备上运行它时。所以,请告诉我这些是应用程序被拒绝的原因吗 请告诉我,为什么会出现这些错误 这是我正在使用的代码。请看一看:Iphone 仅在设备测试时显示内存泄漏。Do';我不知道为什么。?,iphone,objective-c,ios,xcode,memory-leaks,Iphone,Objective C,Ios,Xcode,Memory Leaks,大家好 在我的iPhone应用程序中,当我在显示这些错误的设备上运行它时。所以,请告诉我这些是应用程序被拒绝的原因吗 请告诉我,为什么会出现这些错误 这是我正在使用的代码。请看一看: NSMutableString* s = [[[NSMutableString alloc]init]autorelease]; [s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"]; [s appendFormat: @"<
NSMutableString* s = [[[NSMutableString alloc]init]autorelease];
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
[s appendFormat: @"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns=\"%@\">", ns];
if(headers != nil && headers.count > 0) {
[s appendString: @"<soap:Header>"];
for(id key in [headers allKeys]) {
if([[headers objectForKey: key] isMemberOfClass: [SoapNil class]]) {
[s appendFormat: @"<%@ xsi:nil=\"true\"/>", key];
} else {
[s appendString:[Soap serializeHeader:headers forKey:key]];
}
}
[s appendString: @"</soap:Header>"];
}
[s appendString: @"<soap:Body>"];
[s appendFormat: @"<%@>%@</%@>", method,[params stringByReplacingOccurrencesOfString:@"&" withString:@"&"], method] ;
[s appendString: @"</soap:Body>"];
[s appendString: @"</soap:Envelope>"];
return s;
NSMutableString*s=[[NSMutableString alloc]init]autorelease];
[s appendString:@”“;
[附件格式:@“,ns];
if(headers!=nil&&headers.count>0){
[s appendString:@”“;
for(在[headers allKeys]中输入id键){
if([[headers objectForKey:key]isMemberOfClass:[SoapNil class]]){
[附件格式:@“,键];
}否则{
[s appendString:[Soap serializeHeader:headers-forKey:key]];
}
}
[s appendString:@”“;
}
[s appendString:@”“;
[s appendFormat:@“%@”,方法,[params stringByReplacingOccurrencesOfString:@”和“withString:@”和“,”方法];
[s appendString:@”“;
[s appendString:@”“;
返回s;
我认为您创建了一个NSMutableString。如果不使用ARC,则必须释放它。NSMutableString*s=[[NSMutableString alloc]init]autorelease];
NSMutableString* s = [[[NSMutableString alloc]init]autorelease];
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
[s appendFormat: @"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns=\"%@\">", ns];
if(headers != nil && headers.count > 0) {
[s appendString: @"<soap:Header>"];
for(id key in [headers allKeys]) {
if([[headers objectForKey: key] isMemberOfClass: [SoapNil class]]) {
[s appendFormat: @"<%@ xsi:nil=\"true\"/>", key];
} else {
[s appendString:[Soap serializeHeader:headers forKey:key]];
}
}
[s appendString: @"</soap:Header>"];
}
[s appendString: @"<soap:Body>"];
[s appendFormat: @"<%@>%@</%@>", method,[params stringByReplacingOccurrencesOfString:@"&" withString:@"&"], method] ;
[s appendString: @"</soap:Body>"];
[s appendString: @"</soap:Envelope>"];
return s;
[s appendString:@”“;
[附件格式:@“,ns];
if(headers!=nil&&headers.count>0){
[s appendString:@”“;
for(在[headers allKeys]中输入id键){
if([[headers objectForKey:key]isMemberOfClass:[SoapNil class]]){
[附件格式:@“,键];
}否则{
[s appendString:[Soap serializeHeader:headers-forKey:key]];
}
}
[s appendString:@”“;
}
[s appendString:@”“;
[s appendFormat:@“%@”,方法,[params stringByReplacingOccurrencesOfString:@”和“withString:@”和“,”方法];
[s appendString:@”“;
[s appendString:@”“;
返回s;
这是我正在使用的代码。请看一看。Bunts您可以编辑您的问题:)抱歉,亲爱的,代码中的所有内容似乎都是正确的。但我可以向你保证,这不会成为你的应用被拒绝的原因。这个问题不会在模拟器上出现。那么背后的原因是什么?我建议你删除这个答案。。因为这不是一个答案:)这不是答案,您将我的答案删除为正确。ns,这是NSMutableString吗?。如果您的实例变量为NSMutableString,则必须解除锁定。这可能是应用程序被拒绝的原因吗?我认为您使用更多的NSMutableStrings,例如,ns变量就是NSMutableString?通常情况下:否。但如果您的设备将耗尽内存,并由于内存泄漏而崩溃,则它们会。您的数据库只泄漏了一些字节。。但是如果你能修复它,修复它:)如果你只调用了这个方法一次,而不是1000倍于你的安全性。如果您能将此标记为正确答案,那就太好了:)