Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-02-2009, 10:41 AM   #3 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,575
Default

In this case you already have one cast, but I think it's casting to the wrong class. If bookmarkDict is full of strings, then your loop should be:

Code:
for (NSString *entry in bookmarkDict)
Casting is the way to go in situations like this, when dealing with arrays and dictionaries. The compiler has no idea what type of object is in an array or dictionary, so you need to help it out.

There are other situations where casting would be wrong. I can create and NSString and cast it as a UIView, but that won't make it respond to the right messages for a UIView. It doesn't actually do any "conversion" on the object.
__________________
smasher is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,301
Threads: 39,102
Posts: 171,429
Top Poster: smasher (2,575)
Welcome to our newest member, alekssebasstrs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:03 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.