Errata


#41

Figure 5.5 Diagram of layout for CheatActivity

Phillips, Bill; Stewart, Chris (2015-08-01). Android Programming: The Big Nerd Ranch Guide (2nd Edition) (p. 90). Pearson Education. Kindle Edition.


android:id="@+id/answerTextView"
android:id="@+id/showAnswerButton"

Supplied id’s in Diagram do not correlate with Listing 5.2

Since it is also a break in convention my guess is that Figure 5.5 should be replaced.


#43

I’m not sure if these count as errata exactly, but there’s a couple of issues with the text input validation code in chapter 4. Both of them are somewhat niche, but you might want to address them.

First off, not every country uses a “.” as their decimal separator.

Second, it’s possible for the new input to overwrite part of the old value.
Say 35.5 is currently entered. Select ‘5.5’ and type ‘.’ Now the existing string contains ‘.’ and the newly entered string contains a ‘.’ but the new one is overwriting the old one so should be allowed.

As a simple solution I got any/all selected text and tested it for the decimal delimiter.


#44

Chapter 15, page 248 of the 5th edition we have:

func saveChanges() -> Bool { print("Saving items to: \(itemArchiveURL.path!)") return NSKeyedArchiver.archiveRootObject(allItems, toFile: itemArchiveURL.path) }

Shouldn’t that be:

return NSKeyedArchiver.archiveRootObject(allItems, toFile: itemArchiveURL.path!)

as NSURL.path is an optional?


#45

Pages 98 and 125 both each define the UISegmentedControl for the map view. Page 98 is the original definition, page 125 is the localized definition. They do not agree on the order of the segments. Page 98 defines the segments as Standard, Hybrid, Satellite, while page 125 defines the segments as Standard, Satellite, Hybrid (in Spanish). Since the code which handles the segments isn’t changed during localization, the localized version does not work correctly (the map type does not agree with the segment selected unless Standard is selected).


#46

Not Errata, but a Swift 3 inconsistency that occurs early (in the book). Page 71 (Chapter 4) replace the word ‘where’ in the code with a comma. The new code should read:
if let text = textField.text, !test.isEmpty { // note the comma following textField.text

(Until the 6th edition is released, please let me know if there is a better place to post this type of thing.)


#47

Opps. Typo in the above line: accidental use of the word ‘test’. So, after the comma just match what is in the book: !text.isEmpty


#48

On page 88, chapter 4. Not an error but I think you left out a line of code.

you have

.detail-image-title {
color: white;
text-shadow: rgba(0, 0, 0, 0.9) 1px 2px 9px;
font-size: 40px;
}

but earlier in the book you stated that you should also put in just an rgb value for those browsers that do not understand alpha values. So I think it should read:

.detail-image-title {
color: white;
text-shadow: rgb(0, 0, 0) 1px 2px 9px;
text-shadow: rgba(0, 0, 0, 0.9) 1px 2px 9px;
font-size: 40px;
}

Perhaps this has been already mentioned elsewhere by someone. Just thought you would like to know.


#49

I would post the swift 3 changes in the forum for that chapter–it’s more likely to be discovered there.


#50

Chapter 4 under Number Formatters section (don’t have the page number as I’m not reading a physical book).

The booking lists the following code:

let numberFormatter: NumberFormatter = {
let nf = NumberFormatter()
nf.numberStyle = .decimal
nf.minimumFractionDigits = 0
nf.maximumFractionDigits = 1
return nf
}()

Was giving me an error. I had to change it to this:

var numberFormatter: NumberFormatter {
let nf = NumberFormatter()
nf.numberStyle = .decimal
nf.minimumFractionDigits = 0
nf.maximumFractionDigits = 1
return nf
}

Then the NumberFormatter worked


#51

There should not be a space between the less than symbol! Tu Aashqui