Debugging Guide
Things will go wrong. Builds will fail. Features won’t work as expected. This guide teaches you everything about debugging in Nativeline.Understanding Build Errors
When you see “Build Failed” in Nativeline, it means the Swift code couldn’t compile. This is normal and happens to everyone.What You’ll See
When a build fails:- The chat shows an error message
- The error includes the file and line number
- The AI automatically analyzes and fixes it — no action needed from you
Common Error Types
| Error Type | What It Means |
|---|---|
| Syntax Error | Typo or malformed code |
| Type Mismatch | Wrong data type used |
| Missing Reference | Something isn’t found |
| Ambiguous Expression | Code is unclear |
| Missing Import | Framework not imported |
The Automatic Fix Cycle
Nativeline automatically attempts to fix build errors. Here’s how it works:The 3-Attempt Process
The AI detects and fixes errors automatically. It doesn’t wait for your approval — it just fixes things. You only need to intervene if automatic fixing fails after 3 attempts.
Watching the Process
You can see what’s happening:- The chat shows each attempt
- Code previews show files being edited in real-time
- Tool cards show what actions the AI is taking
- Build status shows success or failure
Debug Logging
For more visibility, you can enable debug logging:/debug again to turn it off.
When Automatic Fixes Fail
If the AI can’t fix the error after 3 attempts, you’ll see a Continue Fixing prompt in the chat.The Manual Fix Process
See the Continue Fixing Card
After 3 failed attempts, a card appears in the chat asking if you want to continue.
Building Your App
Nativeline supports both:- Auto builds — The AI automatically builds after making changes
- Manual builds — You can trigger a build when you’re ready
Providing Context
If the automatic fix keeps failing, add context:“I was adding a save button. The error mentions ‘user’ not found — I think the variable should be ‘currentUser’ from the login screen.”This helps the AI understand what you were trying to do.
Describing Problems Effectively
How you describe issues dramatically affects fix success.Bad Descriptions
- ❌ “It’s broken”
- ❌ “Fix it”
- ❌ “The build failed”
Good Descriptions
- ✅ “The build fails with ‘Cannot find User in scope’ — I think it should use the UserProfile model instead”
- ✅ “This error started after I added the camera feature. The issue seems to be in PhotoView.swift”
- ✅ “The error says ‘Type mismatch’ — it’s expecting a String but I’m passing an Int from the form”
The Bug Report Framework
Using the Code Editor for Debugging
Pro plan or higher required The Code Editor provides powerful debugging tools.Viewing Build Errors
- Open the Code Editor tab
- Files with errors are highlighted
- Click to see the exact line with the problem
- The error message appears inline
Reading Runtime Logs
When your app runs (even successfully), logs show what’s happening:- Open Code Editor → Logs tab
- Run your app
- Watch real-time output
- Look for
print()statements or errors
Adding Debug Prints
Ask the AI: “Add print statements to the saveData function so I can see what’s happening” Or manually add them (Pro plan):Common Errors and Solutions
”Cannot find ‘X’ in scope”
What it means: A variable, function, or type isn’t found. Solutions:- Check for typos in the name
- Make sure the variable is defined in this file
- Check if an import is missing
- Ask: “Where should [X] come from? I see it’s not found."
"Type ‘X’ has no member ‘Y’”
What it means: You’re trying to access something that doesn’t exist on that type. Solutions:- Check the property name
- Verify the type is correct
- Ask: “What properties does [X] have? I’m trying to access [Y]."
"Cannot convert value of type ‘X’ to expected type ‘Y’”
What it means: Type mismatch — you’re using the wrong type. Solutions:- Check if you need to convert the value
- Verify the function signature
- Ask: “Convert [variable] from [X] to [Y]"
"Missing argument for parameter”
What it means: A function call is missing required parameters. Solutions:- Check the function definition
- Add the missing parameter
- Ask: “What parameters does [function] need?"
"Value of optional type ‘X?’ must be unwrapped”
What it means: You’re using an optional value without handling the nil case. Solutions:- Ask: “Safely unwrap [variable] with a default value”
- Or: “Add nil checking before using [variable]“
Debugging Runtime Issues
Not all issues are build errors. Sometimes the app builds but doesn’t work correctly.App Crashes After Launch
Check:- Are all required permissions granted?
- Is network data loading correctly?
- Are you accessing something that’s nil?
Feature Doesn’t Work
Check:- Is the button connected to the right action?
- Is data being saved/loaded correctly?
- Are state changes triggering UI updates?
Data Not Saving
Check:- Is the save function being called?
- Are there any silent errors?
- Is local storage set up correctly?
Prevention: Building Without Errors
Reduce debugging by building better:1. Build Incrementally
Don’t ask for everything at once. Add features one at a time, testing each.2. Be Specific
Vague requests lead to unexpected implementations. Specific requests reduce errors.3. Test Early and Often
Don’t wait until you have 10 features to test. Check after each change.4. Start Simple
Get the basic version working first, then enhance it.5. Use Reference Images
When the AI can see what you want, it makes fewer mistakes.When to Start Fresh
Sometimes it’s faster to start over than to fix:Signs You Should Start Fresh
- The same error keeps returning
- The AI is stuck in a loop
- The code structure is fundamentally wrong
- Multiple features are broken simultaneously
How to Start Fresh (Partially)
“Delete the [feature] code and rebuild it from scratch” This removes the problematic code while keeping the rest of your app intact.How to Start Fresh (Clean Slate)
For the whole project:- Create a new project
- Copy your working ideas over
- Build more carefully this time
Getting Help
If you’re stuck: You can also contact support@nativeline.ai with:- Your macOS version
- What you were trying to build
- The error message (screenshot helps)
- Steps to reproduce