Iphone NSData dataWithBytesNoCopy在发布时触发guardMalloc
请参阅下面的更新Iphone NSData dataWithBytesNoCopy在发布时触发guardMalloc,iphone,ios,web-services,wsdl,base64,Iphone,Ios,Web Services,Wsdl,Base64,请参阅下面的更新 <s:element name="GetFile"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="User" type="s:string"/> <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string /&g
<s:element name="GetFile">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="User" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string />
<s:element minOccurs="0" maxOccurs="1" name="ObjectId" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFileResponse">
<s:complexType>
<s:sequence>
<!-- This is the return value -->
<s:element minOccurs="0" maxOccurs="1"
name="GetFileResult" type="s:base64Binary"/>
</s:sequence>
</s:complexType>
</s:element>
我相信它正在破坏生成的响应对象的反序列化元素fromnode,但还没有找到它。这不是一个“为我调试我的程序”的问题。我的问题很简单-有没有人在wsdl2objc生成的Base64二进制字节数组返回类型中遇到过这个问题
更新
我认为问题在于
+ (id)dateWithBase64EncodedString;
在NSData中(MBBase64)-
我假设这不会让objective-c运行时声明内存。。因此,当我发布NSData时,它仍然以某种方式分配“malloc”。有谁比我更清楚吗?在+(id)dateWithBase64EncodedString中,我将最后一行更改为:
return [NSData dataWithBytesNoCopy:bytes length:length **freeWhenDone:NO**];
这似乎奏效了。这只是我的想法,但如果你是wsdl2objc的作者,希望它能有所帮助
char *data = malloc(...);
NSUInteger length = 0;
... // fill data[length++];
realloc(data, length);
return [NSData dataWithBytesNoCopy:bytes length:length]; //offending line?
return [NSData dataWithBytesNoCopy:bytes length:length **freeWhenDone:NO**];