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 07-11-2011, 08:10 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 2
msukang is on a distinguished road
Unhappy initWithContentsOfFile may not work

I have a problem to solve...

My program can access .jpg file but not .plist.
I have no idea why this happens.
Both files are in the same directory.
---------------

NSString* candleOnPath = [[NSBundle mainBundle] pathForResource:@"candle on" ofType:@"jpg"];

NSLog(candleOnPath);

candleOnImage = [[UIImage alloc] initWithContentsOfFile:candleOnPath];

if (candleOnImage)
NSLog(@"Image not null..");

NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"Drink" ofType:@"plist"];
NSLog(plistPath);

NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithContentsOfFilelistPath];

if (tmpArray)
NSLog(@"tmpArray not null..");
else
NSLog(@"tmpArray null..");
---------------------------------

The results are as follows:
---------------------------------

2011-07-11 10:44:33.186 LightTheCandle[13756:207] /Users/cse/Library/Application Support/iPhone Simulator/4.3.2/Applications/FDF27D59-F508-4D31-BCB1-4EA73D7E55DE/LightTheCandle.app/candle on.jpg
2011-07-11 10:44:33.189 LightTheCandle[13756:207] Image not null..
2011-07-11 10:44:33.190 LightTheCandle[13756:207] /Users/cse/Library/Application Support/iPhone Simulator/4.3.2/Applications/FDF27D59-F508-4D31-BCB1-4EA73D7E55DE/LightTheCandle.app/Drink.plist
2011-07-11 10:44:33.191 LightTheCandle[13756:207] tmpArray null..

--------------
Any Idea why Drinl.plist returns null while candle.jpg doesn't.
(The related files are well located in the supporting files.)

What did I do wrong??
msukang 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: 475
16 members and 459 guests
7twenty7, AlanFloyd, AppsBlogger, David-T, HemiMG, iAppDeveloper, imac74, Jaxen66, lovoyl, Music Man, mutantskin, Paul Slocum, 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:15 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0