开发者

Share NSUserDefaults in universal binary between iPhone and iPad Versions

This is my first stab 开发者_如何学JAVAat creating two targets within one project for iPhone and iPad.

My question is, if I save an array to NSUserDefaults, and the iPhone syncs with iTunes, and then I sync the iPad, will the iPad version have access to the array synced to it?


You either have a universal binary or you have two different targets.

As syncing is concerned, I think it syncs each device differently - even two iPhones should get separate defaults.


While iTunes backs up defaults, it doesn't push them back to the device — there are only a handful of things that it syncs (music/etc, contacts, calendar, ...).

It's also unclear how you want to keep things in sync. Let's say you change the default on both devices, and then sync both of them. What happens?

If you're feeling particularly perverse, you can encode the default into a specially-named contact (and there's a "take me home" app that stores the "home" location in a specially-named contact, IIRC). Presumably this results in an edit conflict; I think iTunes tells the user this and lets them fix the problem by deciding which version to keep.

But I really wouldn't want to rely on iTunes syncing. I go for months without syncing (or waiting long enough for iTunes to make a backup — annoying when the phone bricks itself).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜