Questions tagged [cfdata]

CFData provides support for data objects, object-oriented wrappers for byte buffers.

CFData and its derived mutable type, CFMutableData Reference, provide support for data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Core Foundation objects. CFData creates static data objects, and CFMutableData creates dynamic data objects. Data objects are typically used for raw data storage.

You use the CFDataCreate and CFDataCreateCopy functions to create static data objects. These functions make a new copy of the supplied data. To create a data object that uses the supplied buffer instead of making a separate copy, use the CFDataCreateWithBytesNoCopy function. You use the CFDataGetBytes function to retrieve the bytes and the CFDataGetLength function to get the length of the bytes.

Read more here.

36 questions
14
votes
3 answers

UIWebView - When (or how) does CFData get released?

after multiple days of banging my head against the wall and having sleepless nights I'm hoping to find some help here. I've gone through various posts here, but none of the answers seem to provide a resolution for me. In short, my problem is that my…
Ralph
  • 201
  • 1
  • 6
7
votes
1 answer

How to save CGImage to Data in Swift?

This code type checks and compiles but then crashes. How do I save a CGImage to Data so that I can read it in again later. let cgi: CGImage? = ... var mData = Data() let imageDest = CGImageDestinationCreateWithData(mData as! CFMutableData, …
Rob N
  • 15,024
  • 17
  • 92
  • 165
6
votes
3 answers

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

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,…
leiatlarge
  • 63
  • 5
6
votes
0 answers

How can I reduce CFData(Store)?

I have been looking for the solution to solve below problem, but could not find. I made the filtering method to modify HSV values of UIImage. This method is working fine, but when I use this method, the used memory grows up and they can not be…
5
votes
2 answers

How to return CFDataRef without memory leak?[ios]

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…
user hhh
  • 189
  • 3
  • 11
5
votes
3 answers

Cast NSData as! CFDataRef in swift 2.0

I have a line in a code which became deprecated, there are suggestions in XCode what to replace it with, but I can't get my head around the difference, these are my three lines which worked: let path =…
Jakub Zak
  • 1,212
  • 6
  • 32
  • 53
5
votes
3 answers

Extracting images from a PDF

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…
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
4
votes
1 answer

Climbing CFData memory usage when using Core Image filters

I'm having a problem with too much allocated memory. My app alloc mem reaches up to 100MB! And yes... i'm using ARC. most of memory allocated is by CFData(as i understand it is CoreImage filters). After applying filter to image, CFData allocated…
4
votes
2 answers

EXC_BAD_ACCESS on iOS 6 but not 5 when changing bytes of a CFDataRef

I have an application that applies various filters to an image. It works great on iOS 5 but crashes on 6. Below is a sample of where it's crashing: CGImageRef inImage = self.CGImage; CFDataRef m_DataRef =…
jbender4128
  • 113
  • 1
  • 12
2
votes
1 answer

Source of CFData (store) allocation at app start

At app start, my Cocoa app instantly creates two CFData objects. One of size 34 MB and another of size 57 MB. I cannot seem to figure out what these objects are or where they are coming from within Instruments. Both are allocated before…
Andrew Schreiber
  • 14,344
  • 6
  • 46
  • 53
2
votes
1 answer

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

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.…
Tom Kidd
  • 12,830
  • 19
  • 89
  • 128
2
votes
1 answer

Swift CGPDFContextBeginPage and CFData

I would like to create some PDF pages in Swift. This is my code to create a PDF page // Initialize context and other stuff CGPDFContextBeginPage(pdfContext, aDictionary); CGContextDrawPDFPage(pdfContext,…
Infinite Possibilities
  • 7,415
  • 13
  • 55
  • 118
1
vote
1 answer

CFDataRef and Pixel Data for iPhone Programming

I am trying to access the raw pixels of an image, but I keep running into a problem that got me really stuck. I am pretty new to iPhone programming so it might be something really simple... Here is the class I have, it uses a CGImageRef from an…
samuelschaefer
  • 614
  • 2
  • 10
  • 26
1
vote
1 answer

CFData vs CFString

I have a CFMutableDictionaryRef, part of which in debugger is: "device-id" = <72270000>; model = <474d4120 39353000>; "vendor-id" = <86800000>; Now I can get value of the key model using CFDataRef which returns string like "GMA 950", as…
yolo
  • 2,757
  • 6
  • 36
  • 65
1
vote
1 answer

Get a macOS Keychain certificate's SHA1 hash in Swift

I've retrieved the set of certificates in my keychain using this code: let query: [String: Any] = [ kSecClass as String: kSecClassCertificate, kSecMatchLimit as String: kSecMatchLimitAll, kSecReturnAttributes as String:…
ZAD-Man
  • 1,328
  • 23
  • 42
1
2 3