Discussion Forums  >  Uncategorized

Replies: 2    Views: 529

baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
07/24/11 02:19 PM (14 years ago)

Quiz questions local Data URL? iOS v1.5

Hi, Is there a way to use a local file for the quiz questions data? i.e. a .txt file which holds the quiz questions but that is locally stored (within the xcode project) rather than on a remote website. Thanks as always.
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
07/24/11 11:21 PM (14 years ago)
As of right now, within the control panel, users either reference an outside URL, or generate the questions manually. I'm thinking you could create your local file and manually add it's content (JSON formatted child items) to the source code when in either xcode or eclipse.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/24/11 11:51 PM (14 years ago)
@Parker: Great idea. He could manually add them to the childItems[] array in the BT_config.txt file. Or.... @baywebnz, you could also create a seperate file in the project just of the quiz questions. To do this.... a) Create the quiz file, format it just like the remote file examples. Add it to your Xcode project, just drag in into the DB_Docs folder like adding other Xcode project assets. b) In the quiz controller...(BT_screen_quiz.m) tell it to read the file from the Xcode bundle instead of looking in the cache or online. Have a look at the loadData method in the quiz file, this is where it first looks at the config data, then for a URL. To read a file included in your bundle, use the built in buzztouch method: NSString *quizData = [BT_fileManager readTextFileFromBundleWithEncoding:-1];
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.