I need to convert a NSData object to an NSString. It is meant to be gibberish but I need it for debbuging.
When I use NSString’s initWithData, it breaks as the data has NULL bytes. How can I make it ignore the null bytes and get a proper string?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Copy the NSData to a NSMutableData, byte by byte, skipping any null bytes. Then initialise the string from that.