How to convert a UIImage into NSData November 17, 2013 iOS Development Core Data, NSValueTransformer, UIImage Jay Versluis You can store a UIImage (orI am trying to add an Image into my JSON file that I want to post on the server. I am using the following code but I keep on getting Invalid type in JSON write nsconcretemutabledata to nsdata
My best guess is that you're accidentally passing in the raw NSData instead of an NSString but failing that, the above code should either work correctly or show exactly where things are breaking down.
NSData(NSData, NSData(NSData, NSData(NSObjectFlag) NSData(NSObjectFlag) Constructor to call on derived classes to skip initialization and merely allocate the object. Home ios Invalid type in JSON write in Swift. ios Invalid type in JSON write in Swift On the server side you need to decode the string back to NSData params is a nonoptional dictionary (the compiler can infer that), the type casting to implicit unwrapped Dictionary is meaningless and nsconcretemutabledata to nsdata What is difference between NSData and Data in Swift? Update Cancel. a d b y L a m b d a L a b s. ML workstations fully configured. Data is bridged to NSData and more of an extension of NSData. so where as NSData provides 30 methods Data provides 130 methods.
Convert NSData To NSString In the previous post I wrote a few lines of code to convert an NSString object to an NSData object. In this post Ill do the opposite, putting the conversion into the context how to print an NSData object to the debugging console. nsconcretemutabledata to nsdata Invalid type in JSON write 14: 48 (14) AFNetworking, post, , , In theory, creating a mutable version of an NSData object by referencing its original bytes using [NSMutableData and then modifying those bytes would result in the original immutable object being modified as well.Rating: 4.55 / Views: 388