In iOS, our security is very important, such as data in memory, data in sandbox, and so on, we must consider as a security, and it is urgent for us to make a qualified and safe app.

Recently we were doing this third party security review, and we received a lot of review points.

[Sensitive data residue]

The question is coming up. Their rating agency’s description: “[Sensitive information residue detected after login]” defines the severity of the problem as “critical.”

[Solution]

An extension to NSString has been added in iOS. See how.

- (void)memoryClearStirng{

    NSString *ClearStr = [[NSString alloc]initWithFormat:@ "% @".self];

    const char*string = (char *)CFStringGetCStringPtr((CFStringRef)ClearStr,CFStringGetSystemEncoding());

   memset(&string, 0.sizeof(self));

}
Copy the code

[use]

[self.verifyTextField.text memoryClearStirng];
Copy the code

I will not specifically explain the aspects, please see [Read qian’s blog] god level.