A more commonly used foundation method for converting an object to Jsondata:
+ (Nullable NSData *) Datawithjsonobject: (ID) obj options: (nsjsonwritingoptions) opt error: (NSERROR * *) error;
The error that this method passes is the pointer to the pointer.
Nserror *error;
NSData *jsondata = [nsjsonserialization datawithjsonobject:obj options:nsjsonwritingprettyprinted error:&error];
If the error occurs, the completion of Datawithjsonobject error will not be nil.
The principle of modification is as follows:
-(void) testpointer{
NSObject *object;//declares a null pointer
NSLog (@ "%@", object);
[Self changeobject:&object];//calls methods that modify pointers
Print to see if it has been modified
NSLog (@ "Object------%@", object);
}
-(void) Changeobject: (NSObject * *) Object {
*object = [NSObject new];
NSLog (@ "Object ========%p", object);
NSLog (@ "*object = =%p", *object);
}