cfdata

iOS Download & Parsing Large JSON responses is causing CFData (store) leaks

非 Y 不嫁゛ 提交于 2020-01-21 10:20:33
问题 The first time a user opens my app I need to download lots of data. I get all of this data from the server in JSON form. Depending on the user, these JSON files can be anywhere from 10kb - 30mb each, and there are 10+ of them. I have no problems doing this when the JSONs have no more than 500 or so records, but like I said some have 10,000+ records and can be up to 30mb in size. When downloading the larger JSONs, my app allocs a ton of memory, until I eventually get memory warnings and the

How can I get the contents of an std::string into a CFData object?

孤者浪人 提交于 2019-12-18 07:07:29
问题 I've got a function that returns a std::string object. I'm working with Cocoa/CoreGraphics and I need a way to get the data from that string into a CFData object so that I can feed that into a CGDataProviderCreateWithCFData object to make a CGImage . The CreateCFData function wants a const UInt8* object ( UInt8 being a typedef for unsigned char ). The string represents the bytes from a decoded Base64 string (image data), so it appears to contain many null "characters" so the obvious casting

How to return CFDataRef without memory leak?[ios]

丶灬走出姿态 提交于 2019-12-12 14:25:33
问题 When I return a CFDataRef by (CFDataRef)MyFunction{ ..... CFDataRef data = CFDataCreate(NULL, buf, bufLen); free(buf); return data; } There is a memory leak, how to make CFDataRef autorelease? the method [data autorelease] doesn't exit. 回答1: You can't autorelease Core Foundation objects. (However, you can autorelease Core Foundation objects that support toll-free bridging such as CFDataRef; see @newacct's answer below.) The Objective-C convention is to name your method such that it starts

Swift 3: How to access the value of matrix_float3x3 in a 48-byte CFData?

安稳与你 提交于 2019-12-10 20:09:35
问题 I'm trying to access intrinsic matrix following this answer. By running the commend below, I was able to get a 48-byte AnyObject, and I further convert it into a CFData. let camData = CMGetAttachment(sampleBuffer, kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix, nil) However, I checked the output of sampleBuffer in CMSampleBuffer.h : /*! @constant kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix @abstract Indicates the 3x3 camera intrinsic matrix applied to the current sample buffer.

New CGIImage or CGImageRef from std::string using using base64

巧了我就是萌 提交于 2019-12-08 04:50:20
问题 everyone: I've been working on this for days. Here's a little bit of background. I'm sending an image to a server using protobuf. The image is directly from the camera, so it is not a jpeg nor a png. I found code to get the data from the UIImage using the CGImage to create a CGImageRef. See the following code: - (UIImage *)testProcessedImage:(UIImage *)processedImage { CGImageRef imageRef = processedImage.CGImage; NSData *data1 = (NSData *) CFBridgingRelease(CGDataProviderCopyData

iOS Download & Parsing Large JSON responses is causing CFData (store) leaks

微笑、不失礼 提交于 2019-12-01 14:32:53
The first time a user opens my app I need to download lots of data. I get all of this data from the server in JSON form. Depending on the user, these JSON files can be anywhere from 10kb - 30mb each, and there are 10+ of them. I have no problems doing this when the JSONs have no more than 500 or so records, but like I said some have 10,000+ records and can be up to 30mb in size. When downloading the larger JSONs, my app allocs a ton of memory, until I eventually get memory warnings and the app blows up. It seems the CFData has to be the NSMutableData that I am building in didReceiveData. As I

Extracting images from a PDF

末鹿安然 提交于 2019-11-28 16:15:53
I am having a little query regarding Extracting specifically images ( only images ) from a supplied PDF document in iPhone Application. I have gone through the documentation of apple - But I am failure to find it. I have done following efforts to have the Image from PDF Document. -(IBAction)btnTappedImages:(id)sender{ // MyGetPDFDocumentRef is custom c method // & filePath is path to pdf document. CGPDFDocumentRef document = MyGetPDFDocumentRef ([filePath UTF8String]); int pgcnt = CGPDFDocumentGetNumberOfPages( document ); for( int i1 = 0; i1 < pgcnt; ++i1 ) { // 1. Open Document page

Extracting images from a PDF

我与影子孤独终老i 提交于 2019-11-27 09:38:24
问题 I am having a little query regarding Extracting specifically images ( only images ) from a supplied PDF document in iPhone Application. I have gone through the documentation of apple - But I am failure to find it. I have done following efforts to have the Image from PDF Document. -(IBAction)btnTappedImages:(id)sender{ // MyGetPDFDocumentRef is custom c method // & filePath is path to pdf document. CGPDFDocumentRef document = MyGetPDFDocumentRef ([filePath UTF8String]); int pgcnt =