App::Persistence, NSUserDefaults and key mangling

50 views
Skip to first unread message

Pierrot_de_la_Lune

unread,
May 5, 2013, 7:00:37 PM5/5/13
to bubbl...@googlegroups.com
Hi everybody,

I'm currently learning how to set up a Settings Bundle (using motion-settings-bundle gem ) for an application.
When trying to recover a setting through the key defined in the Setting Bundle, I did not get the expedted valued.

I digged into BW's App::Persistence and discovered that App::Persistence expects that the keys are prefixed by the application identifier,
Although I have no objection to this, I'm still wondering why it is designed that and I feel like I missed something obvious about Settings Bundle.

I would be gratefull to anyone who could explain me the reason(s) behind this choice, Pierrot.

Matt Aimonetti

unread,
May 5, 2013, 8:23:22 PM5/5/13
to bubbl...@googlegroups.com
Pierrot, the settings have to be unique per app, using the application identifier is an easy way to do that.
What behavior would you expect?

- Matt


--
You received this message because you are subscribed to the Google Groups "BubbleWrap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bubblewrap+...@googlegroups.com.
To post to this group, send email to bubbl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/bubblewrap/-/3RP2Q69IkTwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Pierrot_de_la_Lune

unread,
May 6, 2013, 2:14:52 AM5/6/13
to bubbl...@googlegroups.com
Hi Matt,

At first I was thinking it was intended to avoid collision between two apps using the same key. I was puzzled as apps are supposed to be sandboxed.

After some digging, I found that some "system wide" settings can be accessed using NSUserDefaults. I suppose  that the mangling of the key is here to prevent the collision with these system wide settings.
Do I get it right now?

Pierrot.

Matt Aimonetti

unread,
May 6, 2013, 2:48:28 AM5/6/13
to bubbl...@googlegroups.com

Absolutely, at least that's why I wrote it this way. My assumption might have been wrong tho

To view this discussion on the web visit https://groups.google.com/d/msg/bubblewrap/-/tzmastEDNykJ.
Reply all
Reply to author
Forward
0 new messages