Issues
Errors and warnings PadCode finds in your app as you build it: what each one means, how to go to it, and how to fix it.
PadCode checks your app as you build it, the way Xcode checks code. It looks for things that would break when the app runs: a formula with a typo, a step missing a setting it needs, an address that isn't a web address. You see them before you open Preview, so you can fix them in a moment instead of hunting for them later.
#Errors and warnings
There are two kinds of issue:
- Errors, with a red stop sign, are things that would break your app. Errors stop Preview and Finish until you fix them.
- Warnings, with an amber triangle, are things that are probably a mistake but won't break anything, like a variable nothing uses. Warnings never stop you.
#See your issues
When your app has issues, the Builder's toolbar shows their counts, on the right before Preview and Finish: a red count of errors and an amber count of warnings. When there are none, the counts go away.
- Tap the counts. The Issues list opens, errors first.
- Each issue says what's wrong, and under it, where it is: like Button on My App · Actions for a step in the actions of a button on the My App screen, or Data & Logic · total for a variable.
- Tap an issue to go to it.
PadCode checks again a moment after you stop changing your app, so the list stays up to date while you work.
#Where tapping an issue takes you
| The issue is in | Where you go |
|---|---|
| A view's settings | That screen, with the view selected and the Inspector's Style tab open. |
| A view's actions | That screen, with the view selected and its Actions tab open. |
| A screen | That screen, with nothing selected, so the Inspector shows the screen's own settings. |
| A variable, or an API | The Library's Data & Logic tab. |
| A reusable action | That reusable action's steps. |
#Errors stop Preview and Finish
If you tap Preview or Finish while your app has errors, the Issues list opens instead, with a title that says what's in the way: Fix 1 error to preview, or Fix 2 errors to finish. Fix them and tap again.
Warnings never stop Preview or Finish.
#Every check, and how to fix it
In the messages below, words in quotes are your own names: a view's name from Layers, a variable, a screen, a formula. A view you haven't named is called by its kind, written as one word, like TextField. A setting is named the way PadCode stores it, in lowercase, like url for the Url setting.
#Formulas
PadCode reads every formula in your app, and every {…} in text with values: in settings, in Show when, and in steps such as If.
| Message | Kind | What it means | How to fix it |
|---|---|---|---|
| There's nothing called total in “total * 2”. Check the spelling, or add it in Data & Logic. | Error | The formula uses a name that isn't a variable, isn't written by any step, and isn't one formulas always know (params, item, it, event, error, pasted or theme). | Fix the spelling, or add the variable in Data & Logic with Add variable. |
| “count +”: This formula can't be read: it ends too early. | Error | The formula isn't written the way formulas are. The part after the colon says what PadCode tripped on: something unexpected, a missing bracket, text without its closing quote. | Open the formula and fix what the message points at. See Formulas. |
The check makes sure each formula can be read and that every name in it exists. It doesn't run the formula, so a function given the wrong values isn't listed here: the formula editor tells you about those as you type.
#Steps
PadCode checks every step, in views' actions and in reusable actions.
| Message | Kind | What it means | How to fix it |
|---|---|---|---|
| Open Link needs its url. | Error | The step is missing a setting it can't run without, or that setting is blank. | Open the step and fill in the setting. Each action's page lists which settings are required: see All actions. |
| Go to Screen goes to “details”, which isn't one of this app's screens. | Error | The screen it opens was deleted. Open as Sheet is checked the same way. | Pick a screen that exists in the step's settings. |
| Go to Screen goes to “Today”, a widget: widgets are on the Home Screen, not screens to open. | Error | The step opens one of the app's widgets. Open as Sheet is checked the same way. | Pick one of the app's screens. A widget is on the Home Screen: see Widgets. |
| Run Action runs “saveOrder”, which isn't one of this app's actions. | Error | The reusable action it runs was deleted or renamed. | Pick a reusable action that exists. See Reusable actions. |
| Open Link's url: Use a web address (https://), or a mailto: or tel: link. | Error | The address typed into Open Link isn't one it can open. | Type a full address, like https://apple.com, or a mailto: or tel: link. |
| Call API's url: Use a web address that starts with https://. | Error | The address typed into Call API isn't a secure web address. Apps can only call https:// addresses. | Type the whole address, starting with https://. |
| Write Email's to: Use an email address, like name@example.com. | Error | An address typed into To isn't an email address. | Fix the address. |
| Speak Text's language: Use a language code, like en or en-US. | Error | Language isn't a language code. | Type a code like en, fr or en-GB, or leave it empty for the iPad's language. |
| Save File's name: Leave out / \ : * ? " < > and |. | Error | The file name has a character files can't use. | Take those characters out. |
The address, email, language and file name checks look at text you type in. A setting that comes from a variable or a formula is checked when the app runs instead: if it's wrong then, the step fails and the debugger says why.
#Views
| Message | Kind | What it means | How to fix it |
|---|---|---|---|
| What's typed in “Email field” goes nowhere. Link its Text to one of your app's values. | Warning | A Text Field, Password Field or Text Area isn't linked to a variable, so what people type isn't kept anywhere. | Select the field and pick a variable in its Text menu, in the Style tab. See Connecting views to data. |
| “Email field”'s Validation: That pattern isn't a regular expression. Check its brackets and backslashes. | Error | The field's Custom pattern can't be read. | Fix the Pattern in the field's Validation section. See Text field rules. |
| “Website link”'s destination: Use a web address (https://), or a mailto: or tel: link. | Error | A Web Link's Destination isn't an address it can open. | Type a full address, or a mailto: or tel: link. |
| “Photo”'s url: Use a web address that starts with https://. | Error | A Web Image's or Web Page's Url isn't a secure web address. | Type the whole address, starting with https://. |
#Names
Formulas read your variables, colors and inputs by name, so their names have to be ones formulas can use: a letter first, then letters, numbers or _.
| Message | Kind | What it means | How to fix it |
|---|---|---|---|
| “first-name” can't be used in formulas. Start it with a letter, then use letters, numbers or _. | Error | A variable's name has spaces, dashes or other characters, or starts with a number. | Rename it in Data & Logic, like firstName or first_name. |
| The color “brand-2” can't be used in formulas as theme.brand-2. Start it with a letter, then use letters, numbers or _. | Warning | A color in your app's Assets has a name formulas can't read. You can still pick it from color menus. | Rename the color in the Library's Assets tab, like brand2. See Colors. |
| The input “first name” can't be used as params.first name. Start it with a letter, then use letters, numbers or _. | Error | One of a screen's inputs, or a reusable action's inputs, has a name formulas can't read. | For a screen, open the Inspector's Data tab, remove the input under Screen inputs with its minus button, and tap Add input for a new one. New inputs get names like input1, which always work. |
| “total” isn't used anywhere. Show it, change it, or delete it. | Warning | Nothing shows the variable, changes it or reads it in a formula. | Use it somewhere, or delete it from Data & Logic if you don't need it. |
#Apps made with older versions
Older versions of PadCode kept web APIs in Data & Logic, with a base address. New apps put the whole address in Call API's Url instead. If your app still has one of those APIs:
| Message | Kind | How to fix it |
|---|---|---|
| The API “weather”: Use a web address that starts with https://. | Error | Fix the API's address in Data & Logic so it starts with https://. |
| Call API uses the API “weather”, which this app doesn't have. | Error | Pick an API that exists in the step, or type the whole address into Url. |
#Fields that check what you type
Many of PadCode's own fields check what you type as you type it, before it ever becomes an issue. When something doesn't fit, the field gets a red edge and says what's wrong under it.
| The field wants | It says |
|---|---|
| A name formulas can use | Start with a letter, then use letters, numbers or _, like totalCost. |
| A number | Use a number, like 12 or 3.5. |
| A whole number | Use a whole number, like 12. |
| A web address | Use a web address that starts with https://. |
| A link | Use a web address (https://), or a mailto: or tel: link. |
| An email address | Use an email address, like name@example.com. |
| A language code | Use a language code, like en or en-US. |
| A file name | Leave out / \ : * ? " < > and |. |
An empty field always passes: whether a setting is required is a separate check. For which fields check what, and how long each can be, see Text field rules.
The text fields in your own app can check what people type too, with their Validation setting.
#See also
- Preview
- The debugger: problems that only show when your app runs
- Text field rules
- Formulas
- Finish your app