Re: iOS nib weirdness...

2011-05-06 Thread Steve Christensen
Just to provide closure on this thread, I believe I figured out what was 
happening although not why nor who the exact culprit was.

To summarize, all the pieces were set up correctly. The nib file was being 
compiled in response to changes. The problem appears to be that at some point 
it stopped being copied into the simulator as part of running it in the 
debugger. I'm not sure if it was Xcode, the simulator or what. I ended up 
deleting the app from the simulator, rebuilding everything, and haven't seen 
the problem since. Very strange and something I haven't run into before.


On May 4, 2011, at 7:00 AM, Steve Christensen wrote:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code works 
 just fine. That still doesn't explain the other nil values since all three 
 views were wired up in IB: the view controller shows the views connected to 
 the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-06 Thread Matt Neuburg
On Fri, 06 May 2011 01:29:10 -0700, Steve Christensen puns...@mac.com said:
To summarize, all the pieces were set up correctly. The nib file was being 
compiled in response to changes. The problem appears to be that at some point 
it stopped being copied into the simulator as part of running it in the 
debugger. I'm not sure if it was Xcode, the simulator or what. I ended up 
deleting the app from the simulator, rebuilding everything, and haven't seen 
the problem since. Very strange and something I haven't run into before.

Thanks for following up on this. The suspense was becoming palpable.

I do see this kind of thing often enough that whenever anything mysterious 
occurs, or just at the end of the day as matter of routine, I tend to clean all 
targets and reset the simulator, and I have advised others to do the same, both 
in my book and on this list:

http://www.cocoabuilder.com/archive/xcode/293709-app-failure-in-simulator.html

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


iOS nib weirdness...

2011-05-04 Thread Steve Christensen
I'm working on an app that uses a tab bar. I created a new nib to set up a 
view+controller and added a new tab item to the main nib that references the 
controller and the controller's nib, plus I filled in some basic functionality 
in the view controller. Since it's relevant, the controller's IBOutlets are

IBOutlet MyTableView* _resultsTable;
IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
IBOutlet UISearchBar* _searchBar;

When I ran the app and used the new view's UI, I got an unexpected 
unrecognized selector exception when trying to access a custom method in 
_resultsTable. When I looked at their values in the debugger, I found that 
_resultsTable was an instance of UITableView, not MyTableView; and 
_searchActivityIndicator and _searchBar were both nil.

I thought that there could be a missing class issue, but the MyTableView class 
is implemented since creating a test MyTableView instance in code works just 
fine. That still doesn't explain the other nil values since all three views 
were wired up in IB: the view controller shows the views connected to the 
outlets and the views show themselves as connected.

Grasping at straws, I trashed the build results and did a clean build, and even 
re-launched Xcode, with no difference in behavior. I could very well be doing 
something dumb but I'm not exactly sure where to look since I've (correctly) 
set up this same sort of thing before and it worked fine. BTW, I'm using Xcode 
3.2.6 + iOS SDK 4.3. Any ideas?

steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Alexander Spohr
Is your viewController a subclass of UITableViewController?
Then your nib is not loaded.

UITableViewController is broken. It does not keep the contract of 
initWithNibName:bundle:

atze


Am 04.05.2011 um 16:00 schrieb Steve Christensen:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code works 
 just fine. That still doesn't explain the other nil values since all three 
 views were wired up in IB: the view controller shows the views connected to 
 the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
Yes, the table view is typed as MyTableView in the xib.


On May 4, 2011, at 7:21 AM, Evadne Wu wrote:

 Just a wild thought, but could you probably look into the (offending) XIB and 
 make sure that the table view is of a custom class?
 
 -ev
 
 On May 4, 2011, at 22:00, Steve Christensen wrote:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code 
 works just fine. That still doesn't explain the other nil values since all 
 three views were wired up in IB: the view controller shows the views 
 connected to the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
No, the view controller is a subclass of UIViewController and is being 
initialized via -initWithCoder:.


On May 4, 2011, at 7:47 AM, Alexander Spohr wrote:

 Is your viewController a subclass of UITableViewController?
 Then your nib is not loaded.
 
 UITableViewController is broken. It does not keep the contract of 
 initWithNibName:bundle:
 
   atze
 
 
 Am 04.05.2011 um 16:00 schrieb Steve Christensen:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code 
 works just fine. That still doesn't explain the other nil values since all 
 three views were wired up in IB: the view controller shows the views 
 connected to the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Fritz Anderson
On 4 May 2011, at 9:00 AM, Steve Christensen wrote:

 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.

Have you verified that

1) you are inspecting the outlets in the debugger at a time after the NIB has 
loaded and the connections are made? -viewDidLoad would be favorite.

2) Interface Builder knows that your table view is a MyTableView? Check the 
identity inspector (third tab in the Utility area of Xc4, last tab (as I 
remember it) in the floating inspector in IB/Xc3.

3) the other two outlets are actually connected?

4) File's Owner in the XIB for the controller is actually of the controller's 
class?

5) you are not instantiating your controller twice? The MainWindow.xib template 
for tab-based targets does it; do you do it elsewhere yourself?

6) the class of the controller for that tab (in MainWindow.xib) is declared to 
be of the right class?

— F

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread glenn andreas

On May 4, 2011, at 9:00 AM, Steve Christensen wrote:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 


First step:  Don't prepend your ivars with underscores.

From 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html,
 and I quote:

   • Avoid the use of the underscore character as a prefix meaning 
private, especially in methods. Apple reserves the use of this convention. Use 
by third parties could result in name-space collisions; they might unwittingly 
override an existing private method with one of their own, with disastrous 
consequence.



You may be seeing one of those disastrous consequences



Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
On May 4, 2011, at 8:02 AM, Fritz Anderson wrote:

 On 4 May 2011, at 9:00 AM, Steve Christensen wrote:
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 Have you verified that
 
 1) you are inspecting the outlets in the debugger at a time after the NIB has 
 loaded and the connections are made? -viewDidLoad would be favorite.

Yes, I put a breakpoint in -viewDidLoad, as well as just letting it run and 
crash, and then look at the instance variables in the debugger. At both places, 
the table is a UITableView and the other two outlets are nil.

 2) Interface Builder knows that your table view is a MyTableView? Check the 
 identity inspector (third tab in the Utility area of Xc4, last tab (as I 
 remember it) in the floating inspector in IB/Xc3.

Yes, the Type field in the xib file's main window, as well as the Class field 
in the inspector window, show the type as MyTableView.

 3) the other two outlets are actually connected?

Yes, the outlets tab in the inspector window shows the file owner/view 
controller's outlets to be all wired up. And moving the mouse over those items 
highlights the corresponding views in the main xib window.

 4) File's Owner in the XIB for the controller is actually of the controller's 
 class?

Yes.

 5) you are not instantiating your controller twice? The MainWindow.xib 
 template for tab-based targets does it; do you do it elsewhere yourself?

No, my MainWindow.xib has a tab bar controller that has a tab item referencing 
this view controller and its corresponding nib file.

 6) the class of the controller for that tab (in MainWindow.xib) is declared 
 to be of the right class?

Yes, and the controller is being instantiated as expected.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
On May 4, 2011, at 8:17 AM, glenn andreas wrote:

 On May 4, 2011, at 9:00 AM, Steve Christensen wrote:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 First step:  Don't prepend your ivars with underscores.
 
 From 
 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html,
  and I quote:
 
  • Avoid the use of the underscore character as a prefix meaning 
 private, especially in methods. Apple reserves the use of this convention. 
 Use by third parties could result in name-space collisions; they might 
 unwittingly override an existing private method with one of their own, with 
 disastrous consequence.
 
 You may be seeing one of those disastrous consequences

I did think about that. I renamed the ivars to something completely different, 
rewired the xib and tried it out with no difference in behavior.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com