Tag: osx lion

NSUserDefaults and sandboxing under Lion

Moving one of my projects to support sandboxing as per Apple’s requirements. I use UserDefaults like so: [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:myNumber] forKey:myNumberKey]; [[NSUserDefaults standardUserDefaults] synchronize]; Everything works as expected until I enable sandboxing. If I have sandboxing enabled the app creates a lock file in it’s sandbox directory ( .plist.lockfile) and doesn’t create an actual […]

How to Host Apple's Pitch Shift Audio Unit plugin and the like

How do you host the PitchShift Audio Unit plugin correctly in its own window? I am developing a Mac app that hosts Apple’s system supplied Audio Unit plugins. With the new OSX 10.7 Lion, some of the plugins have updated views. PitchShift is one of these. PitchShift and a few others have new knobs to […]

OSX AES Encryption is not working

In my application, i need to encrypt the file before sending it over the network and on the other end, it will get decrypt, This is my code, -(void)doEncryptTest:(NSString *)pFileName{ // read the NSData; NSStringEncoding encoding =NSUTF8StringEncoding; NSString *pFileContent = @”xaaaaaaxxaaaaaax”; NSString *pKey = @”01234567012345670123456701234567″; NSData *pData = [pFileContent dataUsingEncoding:encoding]; NSData *pEncryptedData = [pData AES256EncryptWithKey:pKey]; […]

How to programmatically determine the currently active App in OS X?

I have a simple statusbar applicationn which work in background. I want to know which app currently is active. It is possible?

InterProcess Communication on MacOSX Lion

I’m trying to figure out how to set up IPC between my custom app and a pre-made program. I’m using MacOSX Lion 10.7.2 and Xcode 4.2.1. It doesn’t matter actually what program exactly, since I believe that a similar reasoning may be applied to any kind of external process. For testing purposes I’m using a […]

Get a list of unmountable drives using Cocoa

I would like to obtain a list of drives that are unmountable/ejectable using Cocoa/Objective-C under OS X. I was hoping that NSWorkspace getFileSystemInfoForPath::::: would help me: NSArray* listOfMedia = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths]; NSLog(@”%@”, listOfMedia); for (NSString* volumePath in listOfMedia) { BOOL isRemovable = NO; BOOL isWritable = NO; BOOL isUnmountable = NO; NSString* description = […]

Any NSWindowRestoration examples?

I’m having some trouble implementing NSWindowRestoration (in 10.7 Lion). I’m not getting the protocol notifications. Is there an example app with this implemented somewhere? I cannot find one on the Apple Developer site. Thanks! Edit: The question marked as answer is helpful, but the problem in my case was that I was using a menubar-only […]

Calling App Expose In Lion

Is there any way to call App Expose in Lion programmatically, for example on an event tap, etc?

Objective-C Library – cannot form weak reference to instance of class

I’m currently working with the XMPP Library for Objective-C, and I’m using the “Desktop” example code. It logs in fine; however, when I open a new chat, or someone sends me a message, it crashes. This seems like where something goes wrong: XMPPStream[11678:1b03] RECV: 2012-06-05 15:03:59:379 XMPPStream[11678:1b03] RECV: 2012-06-05 15:03:59:382 XMPPStream[11678:403] RosterController: xmppRosterDidChange: 2012-06-05 15:03:59:387 […]

How do I animate fadeIn fadeOut effect in NSTextField when changing its text?

I am trying to write a category for NSTextField which will add a new method setAnimatedStringValue. This method is supposed to nicely fade-out the current text, then set the new text and then fade that in. Below is my implementation:- – (void) setAnimatedStringValue:(NSString *)aString { if ([[self stringValue] isEqualToString:aString]) { return; } NSMutableDictionary *dict = […]