MS

Hello, I’m Michael Sliwinski, founder of Nozbe - to-do app for business owners and their teams. I write essays, books, work on projects and I podcast for you using #iPadOnly in #NoOffice as I believe that work is not a place you go to, it’s a thing you do.

Apple Shortcuts and problems with IFs and blanks

🔗Shortcuts,🍎Apple

One of the reasons I can be so productive being #iPadOnly is the fact that I use Siri Shortcuts a lot. I have them for Action button, Clipboard management, Notes, Journaling and much more… The problem is that both the Shortcuts app is very poorly written by Apple (crashes, freezes, scrolling issues) and with many iOS updates Apple “upgrades” the way Shortcuts work and suddenly something that used to work, just stops working. Recently this happened to me with my Tinify Shortcut. In iOS18 there was even a bigger change…

Apple Shortcuts and problems with IFs and blanks

Shortcuts change the interpretation of IF statements!

DISCLAIMER: Warning, this post is dedicated to people who know and use Shortcuts a lot. It’s very technical. I wrote it for these people and for myself as a note to self.

If you are a programmer (pun intended!) you know that IF statements are crucial to programming:

IF this happens, do this ELSE do something else!

These are available in all programming languages. Also Shortcuts supports them. However in iOS18/iPadOS18 what I discovered is that the way these IF statements are interpreted is completely differently.

Before iOS18, if a text field was BLANK (empty), Shortcuts interpreted this as having NO value. If a Variable was empty, it also had no value. It was consistent and it worked.

Well, not anymore.

Now there’s nuance. Now, if the text field is empty, it’s empty all right, but it has value… of blank? However, if a Variable is empty, it still has no value.

As I saw my Shortcuts that used to work for me all these years start failing, I realized I needed to go through them one by one and check what’s going on. I also discovered 10 cases of IF statements that have different outcomes depending on what’s there:

  1. When you check IP Address, if it’s not detected it has no value.
  2. If a text field is empty, it has value but is blank - from the drop down you choose “is” and leave the other field blank, i.e. anything
  3. If an empty text field is assigned to a variable, it behaves like 2, so it has value but is blank.
  4. However, if a variable has no value assigned, it has no value and you cannot check if it’s blank.
  5. If you go through several lines with repeat, each command, then each repeat item has value, but may or may not be blank (like a text field). In my Shortcuts I had to change this from has any value to is not empty.
  6. If a Dictionary has no keys or values defined, it’s not empty but it doesn’t have any value.
  7. If a Key in a Dictionary is empty, it always has a value, even a value of blank, so to make sure you know it’s empty, you have to first put it in the text field and just like in (2) you have to see if it is blank…
  8. If you “Ask for input” and don’t write anything in there, it’s not blank, it doesn’t have any value. Completely differently than an empty text field!
  9. If your regular expression doesn’t match what it searches for, it’s not blank, it doesn’t have any value.
  10. Finally, if your Shortcut Input is empty, it’s not really empty, it simply doesn’t have any value.

Uhh. That’s it, I’ve created a handy Shortcut that checks all these 10 situations:

Test - Blank or Not

Feel free to get this Shortcut and run it, if an error pops up, it means that some behavior has changed YET again. I’m planning to be running this Shortcut whenever there’s a new version of iOS.

Shortcuts should be stable and backwards compatible!

Shortcuts are unreliable and annoying yet are the only way to really automate doing stuff on the iPhone, iPad or Apple Watch.

I love these platforms. I love getting stuff done on my iPhone 15 Pro and Apple Watch Ultra as well as my new iPad Pro M4 but going through this iOS18 update and now having to go through all of my Shortcuts to see how and where they are broken is very painful.

Come on Apple, will we ever be able to rely on Shortcuts?

Wednesday, October 16, 2024 /blanks/