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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-05-2010, 01:13 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 28
praveen kumar is on a distinguished road
Default incompatiable error

i have the following code,and the error is incompatible types in assignment
whtz it


check[indexPath.row] = @"1";
praveen kumar is offline   Reply With Quote
Old 08-05-2010, 01:21 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

Since you're using a C array, and not an objective-C NSArray, I can already see that there's going to be an issue. Any time you type something like @"This", you are creating an NSString object which cannot be "inserted" directly into a C array. Out of curiosity, how to do you declare your array (the type, etc.)? At any rate, you're going to have to either define the array as type const char and just insert UTF8 arrays (and convert them to NSStrings when necessary), or use an NSArray and keep the NSString.
SoulRed12 is offline   Reply With Quote
Old 08-05-2010, 05:00 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by SoulRed12 View Post
Since you're using a C array, and not an objective-C NSArray, I can already see that there's going to be an issue. Any time you type something like @"This", you are creating an NSString object which cannot be "inserted" directly into a C array...
Not true. It is entirely possible to use a C array of fixed size to hold a fixed array of Objective C objects. But you are right that in this case praveen probably didn't declare check correctly. It could be compatible if he had declared it as

Code:
  NSString *check[10];
to hold 10 pointers to NSString objects.
RLScott is offline   Reply With Quote
Old 08-05-2010, 12:50 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 386
SoulRed12 is on a distinguished road
Default

Quote:
Originally Posted by RLScott View Post
Code:
  NSString *check[10];
to hold 10 pointers to NSString objects.
Hey, I never knew that...thanks!
SoulRed12 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: 324
10 members and 314 guests
alexP, arash5500, gordo26, mediaspree, nobstudio, Objective Zero, rayjeong, Sloshmonster, stanny, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

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