ios - nsdata dataWithBytes 在 iOS7 上导致崩溃
<p><p>仅在 iOS7 上崩溃</p>
<pre><code>+(PageSection *)initwithPageSection:_anchor withHeader:_subHeader withDetails:_text withPhoneNumberIfValid:(id)_phoneNo
{
const char *tempAnchor = ];
const char *tempSubHeader = ];
const char *tempText = ];
const char *tempPhoneNo = ];
NSData *anchorData = ];
NSData *subHeaderData = ];
NSData *textData = ];
NSData *phoneData = ];
PageSection *p =[init];
p.anchorTag=[ initWithData:anchorData encoding:NSUTF8StringEncoding];
p.subHeader=[ initWithData:subHeaderData encoding:NSUTF8StringEncoding];
p.text=[ initWithData:textData encoding:NSUTF8StringEncoding];
p.phoneNo=[ initWithData:phoneData encoding:NSUTF8StringEncoding];
return p;
}
</code></pre>
<p>使用崩溃的这一行:<code>NSData *textData = ];</code></p>
<p>有什么想法吗??</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>实际上它返回 NULL 但仅适用于 iOS7 <code>const char *tempText = ]; NSLog(@"tex: %s", tempText);</code></p>
<p>这就是它崩溃的原因</p></p>
<p style="font-size: 20px;">关于ios - nsdata dataWithBytes 在 iOS7 上导致崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/20143700/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/20143700/
</a>
</p>
页:
[1]