Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User preferences for arbitrary users



Sheesh. Next time I want to stimulate a rant on proper application design I'll be sure to ask an innocent little API question.

To summarize for the list archives, the question was:

How do I, using the Java APIs, get the equivalent of NSUserDefaults' initWithUser: method? This method is missing from the Java APIs and there's no obvious way to get it. If it were available from the Java Preferences API, that'd be fine too.

The answer is to build a new Objective-C class that calls the method and returns the desired NSUserDefaults instance. To use the new class from Java, I had to generate native stubs for what Java thinks is the class (using the bridget tool makes this semi-painless) and then build a dylib that's ultimately loaded into Java.

I wrote a total of maybe 15 lines of code to do this, but it took half a day to figure it all out!

cheers,
bri

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >User preferences for arbitrary users (From: Brian Pinkerton <email@hidden>)
 >Re: User preferences for arbitrary users (From: email@hidden)
 >Re: User preferences for arbitrary users (From: Brian Pinkerton <email@hidden>)
 >Re: User preferences for arbitrary users (From: email@hidden)
 >Re: User preferences for arbitrary users (From: Brian Pinkerton <email@hidden>)
 >Re: User preferences for arbitrary users (From: email@hidden)
 >Re: User preferences for arbitrary users (From: Brian Pinkerton <email@hidden>)
 >Re: User preferences for arbitrary users (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.