• 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
Re: Solutions for "mocking" out NSUserDefaults?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Solutions for "mocking" out NSUserDefaults?


  • Subject: Re: Solutions for "mocking" out NSUserDefaults?
  • From: Corbin Dunn <email@hidden>
  • Date: Mon, 9 Jan 2006 17:20:45 -0800


Does anyone have any suggestions for imitating or acting like NSUserDefaults transparently in tests? My last resort is to write a class that will wrap NSUserDefaults and allow me to mock it out and return what I want, but it seems a bit hackish.

Well, you probably simply want to change some values. I'd do one of two things:
1. Simply write the values you want out to the userdefaults, even if it is temporarily.
2. Pass them to the app, if you want different userdefaults each time the app is ran. IE: "-MyUserDefaultName Value"


-corbin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Solutions for "mocking" out NSUserDefaults? (From: Jeremy Higgs <email@hidden>)

  • Prev by Date: Re: NSAttributedString: lossy attachments when serializing/archiving?
  • Next by Date: [MEET] Next CocoaHeads Coming Up
  • Previous by thread: Solutions for "mocking" out NSUserDefaults?
  • Next by thread: Guarding against missing ObjC implementation
  • Index(es):
    • Date
    • Thread