Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-24-2009, 01:16 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 3
Brandon2520 is on a distinguished road
Default Singleton isn't accessible?

I'm somewhat new to objective C (been messing with it for awhile but done nothing professional)

Anyways, I'm working on my first real iphone app right now and I keep my apps settings stored in a singleton which gets read and written to a save file.

I created a few of the screens in a separate application and recently merged them into the main project. My problem is now stemming from the fact that I can not access this singleton from within this new classes I just merged! (Before you ask, YES I am including the necessary files :P)

I'm not sure what code to post since there is so much of it, but here is a snippet of a line that works in the old class files but not the new ones:

NSArray *test = [[[Settings sharedInstance] clockClasses] allKeys];

An interesting fact to note is that all of the classes who can successfully access the singleton do so from the loadView method. The classes that can't are attempting to access it in the viewDidLoad method.

What's even more interesting is if I moved the call in the classes who can't access it from the viewDidLoad method to the loadView method, I can sort of access it. (I get an object return with a count of 0 rather than an EXC_BAD_ACCESS error)


Any help would be great. I've been messing with this for about 4 hours now and I know it should be something really simple.

Thanks!
Brandon2520 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 464
16 members and 448 guests
7twenty7, AlanFloyd, David-T, iAppDeveloper, imac74, Jaxen66, logan, lovoyl, markuschow, Music Man, mutantskin, Sami Gh, SLIC, solardrift, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:08 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0