Development

itc1.png

New iTunes Connect fixes usability flaw

Just yesterday I was discussing login screen design with a friend. We looked at some iPhone apps with login screens to find out the best way of implementation.
We came across iTunes Connect as an Apple own application.

itc1.png

  • Layout is done via UITableView (at least visually)
  • The Keyboard fits directly underneath the buttons so you can reach every UI-Element while typing
  • Both fields for “Member Name” and “Password” are filled with a placeholder so the purpose is very clear.
  • Each field provides a info-button for recovering the Apple ID / password (in case you’ve forgotten).
  • If you type in your member name in the first text field an press the “Next”-button on the keyboard, the focus is set directly to the password field. So you can type in the password without being interrupted by having to tap in the password field first to activate it. And after typing the password you can use the keyboards “Go”-button or the “Sign In”-button to initiate the login process.

It’s very handy to use.

But one thing I was always wondering about is the “Cancel”-button. You can not use the app without signing in. Canceling at this point could only mean quitting the app (as you may expect for Desktop applications). But the (iOS) iPhone Human Interface Guidelines for stopping strongly discourages the programmatically termination.
And the cancel button indeed doesn’t exit the app. Instead an “Error” Popup with an dubious error code is shown.
So what purpose may this Button have in the future, I was wondering.

itc2.png

Apple must have read my mind! Today a new version was released and… the cancel button has vanished!

ic3.png

Generate readable log from svn repository

If you want to see, what you have already done for a certain project of your repository, SVN offers you the ability to export the log as a XML-File.

svn log -v --xml https://server.org/svn/project

This will show the log directly in your console. If you prefer the output as a file append

> outfile.xml

If you’d like to have a more human readable output, you can use the following xsl, to transform it to a readable html table:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>SVN Log</h2>
<table border="1">
<xsl:for-each select="log/logentry">
<xsl:if test="author='USERNAME'">
<tr>
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="msg"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Change USERNAME to your svn username and save it to svnstyle.xsl for example.

Now you can use the following command to export and transform the export-xml directly to readable html via:

svn log -v --xml https://server.org/svn/project | xsltproc svnstyle.xsl - > ~/Desktop/svnlog.html

This uses the XSLT-Processor xsltproc, which seams to be preinstalled on a Mac OS X system. But you can replace it with any XSLT-Processor of your choice ;)

The svn command may require username and password – so you may get asked for turing the process.
You can specify a username and password with the parameters –username USERNAME and –password PASSWORD.
But think of the little security issue.

UIDatePickerCrash.png

Malicious UIDatePicker

I used the UIDatePicker a few times already. Mostly in german Apps. I have never had any problems setting the minimum or maximum date properties.
Yesterday we figured out a strange behavior. The App always quit with a “SIGABRT” and the information

-[UIDateTableCell date]: unrecognized selector sent to instance
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIDateTableCell date]: unrecognized selector sent to instance 

UIDatePickerCrash.png

at following line

self.datePicker.minimumDate = [NSDate date];

And it only crashes if the datePickerMode is UIDatePickerModeDateAndTime

self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;

First try, use the setter Method instead of Dot-notation:

[self.datePicker setMinimumDate:[NSDate date]];

same effect.

As you can’t always rely on the simulator, we tried the code on the device. -> No crash!

First thought: A further Simulator discrepancy.

Tried it on a different Mac in Simulator -> NO CRASH!

So what was the difference between the two systems?

Same XCode Version
Same OS X Version

Different System Language!

Changed the language of the device to Language EN, Region US and voila, the App crashes at the expected line.

After a long google session without any hint, we tried some rearrangement of code and put the setting of the pickers date before the setting of the minimumDate.

self.datePicker.minimumDate = [NSDate date];
self.datePicker.date = [NSDate date]:

to

self.datePicker.date = [NSDate date]:
self.datePicker.minimumDate = [NSDate date];

Guess what! Now the App runs fine even on the EN_US Simulator and Device!

So you will say: “it’s obvious you must set the pickers date before you can set a minimum date”.

Hm good point, but:

  1. the API tells you, that even if you omit setting the date explicitly “the default is the date when the UIDatePicker object is created“, so the date property is never nil.
  2. if the Picker is shown in “german” style the App won’t crash.

If your Picker is created by a nib-File as a IBOutlet, the date can be set in Interface Builder.

A second solution

set the Mode of the Picker in Interface Builder initially to “Date & Time”.
PastedGraphic-2.png

In your code you can change the Mode afterwards via datePickerMode.

self.datePicker.datePickerMode = UIDatePickerModeDate;

But Attention:
Setting the Mode in Interface Builder to “Date & Time” initially will cause the Picker to ignore a minuteInterval programmatically set in code.

So set “Date & Time” in IB -> self.datePicker.minuteInterval = 15; has no effect.

set “Date” -> self.datePicker.minuteInterval = 15; will be recognized (if you also set the Mode to Date & Time programmatically) – but you have to set also date to avoid crashing.

So have fun.