• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bridging CFArrayRef and NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bridging CFArrayRef and NSArray


  • Subject: Bridging CFArrayRef and NSArray
  • From: Dave <email@hidden>
  • Date: Mon, 29 Jun 2015 13:57:17 +0100

Hi,

Is the following ok for getting a CFArrayRef and retaining it until dealloc time? Whenever refreshGlobalWindowArray is called I want the existing copy to be released and the new value to be retained.

This is a Mac Project using manual memory management.

All the Best
Dave



@property (nonatomic,retain)	NSArray*		pScriptBridgeGlobalWindowArray;

-(void) refreshGlobalWindowArray
{
NSArray*			myGlobalWindowsArray;
CFArrayRef		myGlobalWindowArrayRef;

myGlobalWindowArrayRef = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly,kCGNullWindowID);

myGlobalWindowsArray = (NSArray*) myGlobalWindowArrayRef;
self.pScriptBridgeGlobalWindowArray = myGlobalWindowsArray;

CFRelease(myGlobalWindowArrayRef);
}

-(void) dealloc
{
self.pScriptBridgeGlobalWindowArray = nil;

[super dealloc];
}



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: re Swift 2.0
  • Next by Date: Cheating a synchronous call on the main thread
  • Previous by thread: re Swift 2.0
  • Next by thread: Cheating a synchronous call on the main thread
  • Index(es):
    • Date
    • Thread