Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
February 20, 2018, 06:54:42 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register Chat  
Pages: [1] 2 3 ... 10
 on: February 11, 2018, 01:27:59 PM 
Started by Chris Prowse - Last post by Suder
Is Xcode 5 still useful for this sort of stuff? Or is there something much better out there nowadays?

 on: January 30, 2018, 05:37:56 PM 
Started by J2000lbs - Last post by J2000lbs
Does Anyone know when this book will be published?  It was supposed to have been January 26, 2018....but it wasn't.


 on: January 25, 2018, 02:19:44 AM 
Started by clouded - Last post by Wolfgangg
Details are saying, well, this makes me think of watching a long time to read and enjoy so much.

 on: January 25, 2018, 02:14:36 AM 
Started by timBob - Last post by Wolfgangg
Recognize the importance that maybe we will get the information you need to apply it in life.

 on: January 23, 2018, 09:21:46 AM 
Started by J2000lbs - Last post by J2000lbs
Thanks MitchB.  I should have known that self wasn't needed there either.  I appreciate it.  I got stuck on this because I had the mind set that it had to be self because that's what was in the book.

 on: January 22, 2018, 02:44:06 PM 
Started by J2000lbs - Last post by mitchb
"No visible @interface for 'AddressBook' declares the selector 'enumerateObjectsUsingBlock:'"

See page 359 and note that enumerateObjectsUsingBlock: is an NSArray method. Self at this point is not known to be an array, but book is, so the method works with the book array. The self in in not needed either.

Code: (Objective-C)
- (void) list1
     NSLog(@"======== CONTENTS OF: %@ =========", bookName);
     [book enumerateObjectsUsingBlock: ^(AddressCard *theCard, NSUInteger idx, BOOL *stop)
           NSLog(@"%-20s    %-32s", [ UTF8String], [ UTF8String]);

 on: January 22, 2018, 10:48:13 AM 
Started by J2000lbs - Last post by J2000lbs
I figured this out.  I'll copy the changes (at the end of this post) I had to make from what was in the book to get it to work without errors.

And I'll leave the original issue posted in case someone it struggling with it.

I don't know if anyone monitors, or reads this site anymore, the posts are all from around 2012-2015.  I'm very new to programming and very new to Objective-C.  I'm trying to teach myself how to program on Apple products right now.  I'm working through the 6th addition of Mr. Kochan's book now in 2017/2018.  I'm using Xcode 9.2 (9C40b).  

When I try to modify the list method from program 15.12 by using the block on page 349:

-(void) list
     NSLog (@"======== Contents of :  %@ ========", bookName);

     [self enumerateObjectsUsingBlock:
         ^(AddressCard *theCard, NSUInteger idx, BOOL, *stop)  {
                 NSLog (@"%-20s      %-32s", [ UTF8String],
                              [ UTF8String] ) ;

                 NSLog (@"===========================================");

 I get the following error message: "No visible @interface for 'AddressBook' declares the selector 'enumerateObjectsUsingBlock:'"

I've looked online and can't find out why this happens and how to fix it.  Any ideas on why and how to fix it?  I'm wanting to learn how and why, not just type in a solution.  Thanks!

Here is how I got it to work, just had to add, the .book to self, which make sense once I thought of it:

-(void) list
   NSLog(@"\n======== Contents of: %@ ==========", bookName);
   [ enumerateObjectsUsingBlock: ^(AddressCard *theCard, NSUInteger idx, BOOL *stop) {
       printf("\n%s, %-10s \t\t  %-32s",
            [theCard.lastName UTF8String], [theCard.firstName UTF8String]
            , [ UTF8String]);

 on: January 22, 2018, 02:42:39 AM 
Started by jonr - Last post by Gragongi
The knowledge I have gained from this content is very important.

 on: January 22, 2018, 02:29:11 AM 
Started by stepbystep - Last post by Gragongi
These data do not know whether there are sources.

 on: November 28, 2017, 09:36:55 PM 
Started by timBob - Last post by Nuttinut
I agree with you I think it is useful. A good comment

Pages: [1] 2 3 ... 10
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 All rights reserved.