I use Core Foundation methods in garbage-collected environment. According to documentation call to CFRelease simply decrements reference count but does not release the object:
The difference between the garbage-collected environment and reference-counted environment is in the timing of the object’s deallocation. In a reference counte...
Hi Everyone,
We have created an iPhone application which has lot of images in that and we are using facebooker plugin. When we are checking for the memory leaks, it shows lots of memory leaks in foundation framework and CoreGrapics. If anyone will be having any idea about this, please share it with me.
Thanks
...
Using the accessibility API, I am drilling down through a series of elements and finding a specific AXUIElementRef I am interested in (all in an external application). How do I check if this element currently has keyboard focus? And if not, how do I set it?
Something similar to using AXUIElementSetAttributeValue to set the kAXMainAttr...
I'm trying to write a small Python script to parse the .strings file in my iPhone application project and determine which keys might not be in use. I'm, also doing some string matching to filter out some of the results. This is where my problems start :). If I try something like
for file_line in strings_file:
if 'search_keyword'...
ABRecordRef addressBookRecord = ...;
ABNewPersonViewController *newPersonViewController = [[[ABNewPersonViewController alloc] init] autorelease];
newPersonViewController.newPersonViewDelegate = delegate;
newPersonViewController.displayedPerson = addressBookRecord;
Is it safe to
CFRelease(addressBookRecord);
?
Is there a standard Co...
I have a function that takes some bitmap data and returns a UIImage * from it. It looks something like so:
UIImage * makeAnImage()
{
unsigned char * pixels = malloc(...);
// ...
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, pixels, pixelBufferSize, NULL);
CGImageRef imageRef = CGImageCreate(..., provid...
Essentially I'm sending data to a Java Socket Server from an iPhone app however something rather strange happens, it doesn't receive the data until the iPhone application is closed! I'm sure there is something I'm missing but I just can't seem to find it, it's all quite odd.
Here is how my connection is created:
-(CFSocketRef)initSocke...
Cocoa is well-documented and there is a lot of information on writing Cocoa code in good form. I'm working on some code that works closely with hardware, requiring me to use CoreFoundation and Carbon APIs often. Is there any sort of 'style' guide for understanding libraries such as Carbon and CoreFoundation from Apple? Apple's example...
I'm writing some code that is wrapping up some CFNetwork stuff to do DNS resolution in Objective-C.
Everything is fine and it's working, but I have a few questions:
The callback function prototype for CFHost's asynchronous resolution is passing references to CFStreamError structures even though the documentation says CFStreamError is d...
How can I get in Mac OS X "global" mouse position - I mean how can I in cocoa/cf/whatever find out cursor position even if it's outside the window, and even if my window is inactive?
I know it's somehow possible (even without admin permissions), because I've seen something like that in Java - but I want to write it in ObjC
Sorry for my...
I'm some what confused as to the difference between accessing an instance variable via self or just by name (when working inside the class).
For instance, take this class:
.h:
@interface Register : NSObject {
NSString *mName;
}
- (id) initWithName:(NSString *) name;
.m:
- (id) initWithName:(NSString *)name
{
if (self == [supe...
I would like to iterate through a CFDictionary (CFPropertyList) and get all values on a specific level.
This would be my dictionary / property-list:
root
A
foo
0
bar
0
B
foo
10
bar
100
C
foo
20
bar
500
Using ObjC it would look something like this:
//dict is loaded wit...
The following leaks:
CFStringRef labelName = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(aMultiRef, indexPath.row));
cell.textLabel.text = (NSString *)labelName;
CFRelease(labelName);
Wondering if there a way to rewrite it so it doesn't leak without breaking out & assigning ABMultiValueCopyLabelAtIndex(aMultiR...
Title should be self explanatory. I'm interested in first hand experience, or specific documentation that describes which approach is preferable and why.
...
I know the quick and dirty way of dividing by 60 to get minute, hours, etc
But is there an official way in the API already implemented, and using the appropriate language for minutes, seconds, etc?
Thanks for any help.
...
I'm writing a C++ plugin in Mac OS X using the Carbon framework (yeah, yeah, I know, Apple is deprecating Carbon, but at the moment I can't migrate this code to Cocoa). My plugin gets loaded by a master application, and I need to get a CFBundleRef reference to my plugin so that I can access it's resources.
The problem is, when I call C...
Hello all,
I've been working on an iPhone for several months. It's a 2d shooting game akin to the old Smash TV type games.
I'm doing everything alone and it has come out well so far, but now I am getting unpredictable crashes which seem to be related to CoreFoundation forking and not exec()ing, as the message __THE_PROCESS_HAS_FORKE...
Hi all,
A short but sweet question: Can I use Apple's open source Core Foundation (CF classes) in a commercial product for free? That is, can I compile and link against the libraries without open sourcing my own applications's code? Obviously if I alter the original CF code, I would submit the changes.
It's a very well constructed AP...
I've heard that it is a bad idea to do something like this. But I am sure there is some rule of thumb which can help to get that right.
When I iterate over an NSMutableDictionary or NSMutableArray often I need to get rid of entries. Typical case: You iterate over it, and compare the entry against something. Sometimes the result is "don'...
Recently while trying to answer a questions here, I ran some test code to see how Xcode/gdb reported the class of instances in class clusters. (see below) In the past, I've expected to see something like:
PrivateClusterClass:PublicSuperClass:NSObject
Such as this (which still returns as expected):
NSPathStore2:NSString:NSObject
......