Powered by Max Banner Ads 

Now that I’ve started working with the latest and greatest iPhone SDK I’m running into a bunch of deprecated method errors. It’s recommended practice to treat warnings the same as errors so I have been trying to fix them as they pop up. The one in particular that was giving me trouble today was:

NSString *contents = [NSString stringWithContentsOfFile:fullpath];

After doing a bit of Googling I found the solution.

Replace NSString *contents = [NSString stringWithContentsOfFile:fullpath]; with:

NSString *contents = [NSString stringWithContentsOfFile:fullpath encoding:NSUTF8StringEncoding error:nil];[NSString stringWithContentsOfFile:fullpath encoding:NSUTF8StringEncoding error:nil];


(Side Note: Ever since I began coding my vocabulary has expanded. Now I get to use words like Redacted and Deprecated ;-) Thanks Apple!)

Tagged with:  

8 Responses to FIXED: stringWithContentsOfFile is Deprecated Error

  1. angel says:

    Thanks man really helped getting that nasty warning out. Appreciated.

  2. Muhammad Kalim says:

    Thanks its really helpfull ..

  3. Thanks for the useful tip.

  4. ubert says:

    Excellent, thanks!

  5. hamjoon says:

    Thanks a lot! really helped :)

  6. Manish Mukati says:

    Thanks a lot, it really helped me.

  7. Neogaz says:

    Thank You!! U Rock!!

  8. Abhinav says:

    Thank al LOOOOOOOOOT man you solved my font embedding issue ! ! ! !

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!