Using the ‘plutil’ utility to fix improperly-formatted Xcode plist files

How do you find typos (syntax errors) in an improperly formatted plist (property list) file, especially when Xcode provides absolutely no detail about badly formed XML? I often see plist files with a thousand or more lines of text! In this article, I’ll show you how to fix plist bugs — and do a few other things — by using the little-known plutil command line tool.

How many times have you seen the following error message, shown below in textual and graphical format, when doing a build?

Info.plist build error

Jump straight to the fix or take a minute to read a little background.

Continue reading “Using the ‘plutil’ utility to fix improperly-formatted Xcode plist files”

The fix to Mojave slowing down to a crawl and freezing

If you’re one of the brave people who’ve installed Apple’s new Mojave (macOS 10.14) operating system, you may be experiencing extreme sluggishness and steady slowdowns after boot until everything just freezes up and you can’t do anything. It’s really exasperating, but there’s a cure for the freeze-ups… If your Mac’s primary drive has multiple partitions, and/or you have an external drive attached, and/or your external drive has multiple partitions.

Continue reading “The fix to Mojave slowing down to a crawl and freezing”

Fix for prohibitory symbol (do not enter, stop sign) when booting into or updating macOS Mojave 10.14 (including betas)

FLASH: Updated 11/9/22 with a tutorial on how to obtain installers for macOS Ventura 13.0 and many older macOS versions.
FLASH: Updated 10/25/18 with NEW INSIGHTS on how to deal with the prohibitory symbol. When installing the macOS Mojave 10.14 beta 11 and then the public macOS Mojave 10.14, I ran into the prohibitory symbol again, actually twice during both installations, but got through to the final install in both cases. You should read this entire article, but if you’re in a hurry, jump to the section covering working around hitting the prohibitory symbol twice.

TOP NEW TIPS
  • If you get the prohibitory symbol multiple times, you may have to shut down and restart your Mac multiple times.
  • Boot into another APFS-based partition, like High Sierra (macOS 10.13), run Disk Utility, and then run First Aid on the Mojave partition. If Disk Utility reports that it fixed the Mojave partition — or even if it just gave the partition a clean bill of health — I’ll bet your problems will be solved.

Continue reading “Fix for prohibitory symbol (do not enter, stop sign) when booting into or updating macOS Mojave 10.14 (including betas)”

Xcode 9 playground error: No such module ‘UIKit’ (or ‘AppKit’)

While creating a new Xcode playground on my MacBook Pro today, I got the most bizarre error message: “No such module ‘UIKit'”. I was using Xcode Version 9.2 (9C40b). Yes, I know there are more recent versions, but I haven’t had the need to upgrade my MacBook Pro. Parenthetically, I do have Xcode 9.4.1 (9F2000) and Xcode 10 beta 6 (10L232m) loaded on my main development machine. I’ll share the solution to this problem with you in the hopes that you, like me, will learn something new about Xcode today.

Continue reading “Xcode 9 playground error: No such module ‘UIKit’ (or ‘AppKit’)”

Controlling chaos: Error checking in Swift 4 with if let, guard, and failable initializers

Swift tutorials by iosbrain.com In this tutorial, the third in a series of tutorials, we’re going to finish the arduous topic of looking for unexpected values, events, and conditions that arise during program execution, using a technique I like to call “error checking.” Today, I’ll concentrate on nil values, optionals, optional binding, the guard statement, failable initializers, and finally, give you some advice about keeping your error checking code consistent, for example, when to use Swift “Error Handling” or when just to return true/false or use guard statements.

Continue reading “Controlling chaos: Error checking in Swift 4 with if let, guard, and failable initializers”

Fixing memory leaks — strong reference cycles — in Swift 4

PREREQUISITES FOR THIS TUTORIAL

If you don’t understand how Swift manages memory for classes (reference types), you need to read the first article in this series, “Swift 4 memory management via ARC for reference types (classes)”. Once you understand how reference type-based memory is managed with ARC, you’ll be ready to understand how to prevent memory leaks from occurring in your app. Remember that ARC only applies to reference (class) types, not value types like struct and enum instances.

THE ARC DEALLOCATION PROCESS

Remember how we visualized the reference count that ARC maintains on the allocated instance of reference type Widget in my introductory ARC tutorial?

Continue reading “Fixing memory leaks — strong reference cycles — in Swift 4”

The iOS file system in-depth (and how to be the best using critical thinking)

Have you ever wondered how all those people out there figured out how to manipulate the iOS file system in their apps? For some strange reason, Apple has never provided well-organized documentation on the subject. Here’s how I feel: “Ask and simple question and get an obtuse and overly complex answer.” There are many articles and tutorials out there, including my own, showing you examples of Objective-C or Swift code for manipulating the iOS file system, and most of the code looks basically the same. Nonetheless, this code is deceivingly complex, often underestimated, and rarely well-explained or well-understood.

Where did everybody find this boilerplate code? From simple observation, I’ve found that in many cases, developers use a copy and paste methodology, i.e., look up a few keywords in a web search engine, find the code needed on sites like StackOverflow or some blog, copy it, paste it into an Xcode project, and beat on it until it works. I don’t want you to feel this way after reading my tutorials.

I hope you’ll find it edifying and interesting to read about how I figured out how to understand and navigate the iOS file system using the “most of the code looks basically the same” boilerplates. But I bet you’ll find it even more intriguing to find that I’ve discovered an much better alternative to the boilerplate code.

Continue reading “The iOS file system in-depth (and how to be the best using critical thinking)”

Downloading and installing an old version of OS X (mac OS) on your Mac

We’re going to talk about installing a version of your Mac’s operating system (OS), known as “macOS” or “OS X,” on your Mac, older than the one you’re currently running, on a partition of your primary hard drive or on an external hard drive. You may find that your current instance of OS X is too unstable for normal day-to-day usage or more heavy-duty tasks like development. Remember all the problems people had when they upgraded to OS X 10.13, also known as “High Sierra?” Oy, vey. You might have been like “Get me the heck outta Dodge!” You wanted or needed to get back to a stable OS, like Sierra (OS X 10.12) or El Capitan (OS X 10.11). For developers, you may have to install an older version of Xcode not supported by your latest OS. For Cocoa/macOS developers, you may need to make absolutely sure that your desktop apps are backward compatible, and the only way to do that for sure is to install and run your apps on older versions of macOS. I will show you, step by step, how to get a valid copy of an older version of macOS, make a bootable installer disk, and install the old OS.

Continue reading “Downloading and installing an old version of OS X (mac OS) on your Mac”

Xcode: using the “Debug executable” checkbox to step through app release versions

Here’s an Xcode setting, but what does it do for developers?

There’s a checkbox named “Debug executable” on the “Info” pane for Xcode’s “Debugging Options in the Scheme Editor.” Why is there such a dearth of information on this checkbox, a “simple” Xcode scheme option? Apple has little to say about the feature. Information about it is scarce on the web. I’ve heard all sorts of different opinions about what the checkbox does or doesn’t do. (Some of this may be exacerbated by Apple releasing buggy versions of Xcode.)

I’ll discover and explain, using the scientific method, how the “Debug executable” checkbox works. You may be thinking this is much ado about one checkbox, but my purpose is to get you to think about and learn a lot about debugging with Xcode. The absolute best developers are the ones with great and instinctive debugging, nay, TROUBLESHOOTING, skills.

Continue reading “Xcode: using the “Debug executable” checkbox to step through app release versions”

Debugging: symbolicating crash reports manually (stack trace, backtrace)

Swift tutorials by iosbrain.comToday, we’ll talk about manually symbolicating iOS and OS X application “crash reports.” Why? When you hear about a crash in one of your apps from a customer, the first thing you should do is try to get a copy of the crash report. But there are times when you get crash reports that aren’t automatically symbolicated, or that you can’t symbolicate by dragging into Xcode, or are partially symbolicated. When not symbolicated, you’re reading numeric addresses when you want to be reading code, like your function/class names. There are workarounds and we’ll discuss one today. Download the sample Xcode 9 project written in Objective-C to follow along. What’s a crash report, anyway? According to Apple:

Continue reading “Debugging: symbolicating crash reports manually (stack trace, backtrace)”