On Feb 12, 2016, at 11:31 AM, Charles Jenkins wrote:

> Alex,
> 
> The suggestion of changing the graphic’s name is a terrific one. I’ll do that 
> tonight, and I expect it will work. I should’ve thought of that myself. 
> Thanks!

Yay.

> I’m using Swift, but whether my controller conforms or not is the nature of 
> my question. I wasn’t totally clear, but when I said I added 
> UISearchBarDelegate to my controller, I meant I added that protocol name to 
> the list of protocols implemented by the class. Then I added the one optional 
> protocol method I actually need (and I didn’t do something terribly stupid 
> like marking it static). But when I set the status bar’s delegate to self, I 
> crash anyway, as if I’m not really conforming. Since all the methods in the 
> protocol are marked as optional, I don’t know what I could be missing.

Ahh, I express my ignorance of Swifty matters.  Was thinking through this as if 
it was an Objective-C project.

> This is behaving as if my outlet were connected to the wrong kind of object. 
> I think tonight I’ll delete it an re-drag from IB again, just to make sure my 
> outlet really is getting set to an instance of UISearchBar.

AHA!

AAAAAHH HAH!

Do you possible have it wired to more than one outlet???  This has happened to 
me in the past.

Of course, we do have the case of an unrecognized selector is being sent to 
"something".  Well, what is that something?  That will tell you a lot.  Is it 
being sent to nil?  What is the class of the object that it is being sent to 
when the exception is triggered?

That will tell you a lot and help you track it down.  If the searchbar is wired 
correctly once and incorrectly on another outlet, then you DO have it working, 
but you also have it failing too.  It can be tricky.

Also, if you dropped into the debugger and issued the method call to self, does 
it also crash?  If so, then you thought you were conforming to the delegate, 
but you're not.

If you are conforming, make sure to then in code set the delegate to self so 
that your class not only confirms, but is actually hooked up to it and ready to 
not crash when it gets that selector sent to it.

Fingers crossed, but those are pretty much the general cases that would cause 
these issues that I've run in to.

I think it's not too hard to figure out if it falls into the above issues.

Lemmie know.  Cheers

Alex Zavatone

> -- 
> 
> Charles
> 
> On February 12, 2016 at 11:07:00, Alex Zavatone (z...@mac.com) wrote:
> 
>> 1. What are you setting the delegate to? Self? If so, have you made sure to 
>> "conform" to that delegate in your class? Something like @interface 
>> CharlesViewController : UIViewController <UISearchBarDelegate> ?? 
>> 
>> If you don't do that, then the method you need isn't accessible through self 
>> and BLAMMO! Unrecognized selector sent to instance. 
>> 
>> 
>> 2. Are you including the asset lib in your bundle for the build? 
>> 
>> Is the old name the same as the new name? Change the name of the graphic and 
>> see if it's even in the new build. 
>> 
>> GL Charles. 
>> 
>> Alex Zavatone. 
>> 
>> On Feb 12, 2016, at 8:59 AM, Charles Jenkins wrote: 
>> 
>> > PROBLEM 1: 
>> > 
>> > Is there anything new/tricky about the UISearchBar? I have placed one in 
>> > my view, and dragged an IBOutlet to the companion source file. The result 
>> > is an @IBOutlet weak var searchBar: UISearchBar! 
>> > 
>> > I added UISearchBarDelegate to my ViewController and implemented one 
>> > method: func searchBar(_ searchBar: UISearchBar, textDidChange searchText: 
>> > String) 
>> > 
>> > My app works beautifully if I do NOT set searchBar.delegate = self in 
>> > viewDidLoad(). But if I try to set that delegate to make search work, my 
>> > app crashes on launch with an unhandled exception saying that an 
>> > unrecognized selector was called. 
>> > 
>> > UISearchDelegate’s methods are all marked “optional," I think, but I’m 
>> > wondering if in the latest version of iOS, one or more of them isn’t 
>> > really optional anymore…? 
>> > 
>> > PROBLEM 2: 
>> > 
>> > I made a change to my launch image graphic and dragged the new version 
>> > into the assets. The new image shows up there and in my LauchImage UI 
>> > view, but there seems to be nothing I can do to get it onto a device! 
>> > 
>> > I performed these steps: 
>> > Cleaned my project 
>> > Cleaned my project build directory 
>> > Quit Xcode 
>> > Rebooted my computer 
>> > Deleted the test app from my device—at this point, the old launch screen 
>> > should not exist ANYWHERE 
>> > Restarted Xcode 
>> > Reconnected my device 
>> > Started a debug session, which should have rebuilt and reinstalled a 
>> > fresh, clean copy onto the device 
>> > But somehow the old launch screen appears every time. Clearly there is a 
>> > cache somewhere that is not cleaned out with the project or its build 
>> > directory. 
>> > 
>> > What’s the secret to really getting rid of Xcode’s memory of an old launch 
>> > image? 
>> > 
>> > -- 
>> > 
>> > Charles 
>> > _______________________________________________ 
>> > 
>> > 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: 
>> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
>> > 
>> > This email sent to z...@mac.com 
>> 

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to