Images missing from iOS bundle

I was working on a “framework” for an iOS app.  When I added image resources, they did not work.

After Googling about for the answer, it seems that Apple added a setting for the MacOS framework template to combine related image files (like image.png and image@2x.png) into one multi-image TIFF file.  Since we based our product on that template, we had that setting. All the images were being put into files the iOS did not support.

If you have this problem, search your project for COMBINE_HIDPI_IMAGES. Be sure that it is set NO in all targets.

Favorite Quotes 6

“The only thing you can safely assume is that it is unsafe to assume anything.” – Walt Sellers

I recently wrote this while discussing things with a colleague.  Eric Rodriguez-Diaz long ago taught me to challenge my assumptions. I now believe that bad assumptions are a large part of most of the bugs in code.

Tags: ,

Why its hard to use auto-correct on the search bar…

One of the best QA people I have ever worked with caught something that really impressed me.  She was working on reports of crashes while touching cells in a UITableView which was the result of a search.  When the user would touch one of the cells, the app would sometimes crash.  She noticed that the crashes only happened IF autocorrect was showing when the user touched the cell AND the auto-corrected search string would produce no results.  (I really wonder if I would have noticed such a detail.)

As it turned out, once the auto-correct is showing, any touch that is not the keyboard or the auto-correct’s popup (for dismissal) then the touch is considered an “accept” of the suggestion.

The part of this that caused the crash was the combination and simultaneous nature of the events. The auto-correct is accepted first. This causes a change in the search results which are the data source for the table. But the touch is also processed for the UITableView. It results in a didSelect call for the index path originally touched.  This can result in an attempt to access something that no longer exists.

The quick and easy solution is to disable auto-correct on the search bar.  That prevents the whole mess.

But, it also shows that if the data source is not prepared for the possible attempt to use bad numbers, it could result in a crash. And are we really sure that some other subtle combinations of things won’t also result in bad numbers?

A final thought:  If you correct your code to handle the invalid indexPath after the change of search, assume there is a result that winds up with the same indexPath.  It probably will not be the same result that was there before. Now the user will think there is a bug and file a bug report.

 

When the iOS auto-correct will NOT appear…

Are you trying to make auto-correct give a suggestion, but it won’t appear?

Make sure to use the on-screen keyboard to do the typing.

It turns out that iOS knows if you are typing on the on-screen keyboard or a physical keyboard. If you are using a physical keyboard, it won’t present suggestions.

This held true for both the simulator and the device.  When I tested using the simulator, the keyboard on the computer would not cause suggestions.  When I tested using a bluetooth keyboard with an iOS device, it would not cause suggestions either.

Interview Questions to Ask an iOS Developer

“What annoys you about Xcode?”

The most important part of the candidate’s answer is how fast they candidate give it.  Someone who has used any development environment for a while will want something improved.  (You do too, don’t you?)  The more passionate the feelings about the annoyance, the faster it will come to mind from the question.

A coworker and I worked out this question while doing phone screenings.  We wanted to find a way to rapidly determine experience levels.

What do you think?

Tags:

IDE Feature Wish List – Adding Methods for Properties

This one comes from working with Xcode one version back from the latest (I still need to build for armv6) so the latest Xcode may already have it.

Xcode should help us manually add properties and their methods as easily as it adds them for IBOutlets in Interface Builder.

When we edit .XIB files, we can just drag connections over to the .h file in the assistant editor and a property will be added to the header. It will also add @synthesize lines and releases in both dealloc and viewDidUnload.

Why can’t Xcode do that when we add properties that are not IBOutlets?

IDE Feature Wish List – Programmer Popup Descriptions

More things for the IDE (Integrated Development Environment).  Xcode is the one I use for iPhone development,  so hint, hint Apple.

Like a desktop program or web page allows you to hover the mouse pointer over something to get information about it, the IDE should give me more information about a variable when I make a gesture for it.

Now Xcode already has some hover information for some things.  It shows the type and some contents of a variable.

What I’m talking about is giving developers the ability to see information they have set about a variable.

It would also be great to have quick access to documentation, known bugs, easy mistakes to make, valid value ranges, etc.

It would be better than having to track down the definition somewhere in the header files or source files to see if (maybe) someone put a comment by it.

It might also encourage developers to write more and better comments.

XCode 4 Column-Wise Copy-Paste Changed – Update

By accident today, I found that the built-in application TextEdit still supports column-wise copy-paste operations the way I liked them in old versions of Xcode.

I had copied a column of numbers from Xcode and pasted it into a document assuming that TextEdit would just paste it in linearly and I would fix up the format afterward.

SURPRISE!  It pasted in columnar fashion just like Xcode once did.  It made short work of my editing.

A quick test showed that I can hold the option key and copy in columnar fashion as well.

Neither Xcode nor TextWrangler can paste this way.

TextEdit just got more valuable to me for doing work.

My previous blog post on this matter.

Tags:

Xcode 4.3.2 pains and tips 1

So far, XCode 4.3.2 has been irritating.  It crashes far too often.  But here is some of what I’ve learned:

Get a funny response from copy and paste in Xcode? Strange response from Xcode from undo?  Did the change not appear in Xcode?  Did lines disappear from Xcode?

These kinds of things usually indicate that a crash will be happening soon.

Sometimes I can recover by changing to another file, then changing back. This does seem to help keep Xcode running.

My editing habits probably contributed a little. I tend to scroll around, then use undo-redo in quick succession as a way to go back to where I was in the file.  Usually this was fine in previous versions, but Xcode 4.3.2 seems to crash a lot right after I do this.

 

Tags:

IDE Feature Wish List – Spell Check Comments

More things for the IDE (Integrated Development Environment).  Xcode is the one I use for iPhone development,  so hint, hint Apple.

 Check Spelling Inside Comments
This a useful feature, really.  I often use the TextEdit application that came with my Mac and it will auto-correct while I type.  On average, this is a big plus when my fingers get a little out of order and transpose two letters.
Since the comments are about the written communication from one human developer to other human developers, having spell-check is really important.
See my previous posts that talk about having comments written in RTF so we can communicate with more than plain text.  (Why are we still stuck with plain-text source files in 2012?)

Tags: , ,