This document provides debugging checklists, common issues, and operational guidance.
fatalError in CaluruApp.swift (ModelContainer creation)Cmd+Shift+K)isStoredInMemoryOnly: false in CaluruApp.swiftcontext.save() is being called@ObservableNSCameraUsageDescription in build settingsAVCaptureDevice.authorizationStatusCause: Manual Info.plist file conflicts with auto-generated one.
Solution:
# Delete any Info.plist in source folder
rm Caluru/Caluru/Info.plist
Cause: Missing import statement.
Solution:
import SwiftData // Add to file
Cause: Swift 6 strict concurrency.
Solution:
// Option 1: Mark class as @MainActor
@MainActor @Observable
class MyViewModel { ... }
// Option 2: Capture self explicitly
Task { @MainActor in
self.property = value
}
Cause: Seed check finds existing profile (or CloudKit synced profile).
Solution:
Or temporarily modify SeedDataService:
// Force re-seed (for debugging only)
guard false else { // Change from existingProfiles.isEmpty
Cause: No network, or user not signed in (proxy requires JWT).
Solution:
OPENAI_API_KEY and is deployed with --verify-jwt.Cause: CloudKit may not have synced profile yet; hasCompletedOnboarding is false until profile appears.
Solution: Wait a few seconds (app uses ~2s delay) or sign in with Apple so profile can sync. If testing, complete onboarding again.
Cause: Complex predicates not supported.
Solution:
// Bad: Complex computed property
#Predicate { $0.mealTypeEnum == .desayuno }
// Good: Compare raw value
#Predicate { $0.mealType == "desayuno" }
Cause: Codable struct mismatch.
Solution:
// Add explicit error handling
var entries: [MealEntry] {
get {
guard let data = entriesData else { return [] }
do {
return try JSONDecoder().decode([MealEntry].self, from: data)
} catch {
print("Decoding error: \(error)")
return []
}
}
}
| Location | Log Type |
|---|---|
SeedDataService.seedIfNeeded() |
“Seeding initial data…” / “Seed data already exists” |
CaluruApp ModelContainer |
fatalError on creation failure |
// In ViewModels
func loadData(context: ModelContext) {
#if DEBUG
print("[HomeViewModel] Loading data for \(selectedDate)")
#endif
// ... implementation
#if DEBUG
print("[HomeViewModel] Loaded \(dailyLog?.entries.count ?? 0) entries")
#endif
}
-com.apple.CoreData.Logging.stderr 1Reproduce:
Check:
loadDailyLog called on date change?Reproduce:
Check:
regenerateFromPlan being called?daysData populated?ingredientsData populated?Reproduce:
Check:
loadTodayLog called in AssistantViewModel?dailyLog being passed to AssistantResponseService?Location: DailyLog.entries, Recipe.ingredients, WeeklyPlan.days
Symptom: Slow UI when accessing nested data
Mitigation:
Location: RecipesView LazyVGrid
Symptom: Scroll jank with many recipes
Mitigation:
LazyVGrid (good)Location: ShoppingListBuilder.build(from:)
Symptom: Slow when plan has many recipes
Mitigation:
Currently not implemented. To manually export:
// Add to a debug menu
func exportData() {
let descriptor = FetchDescriptor<DailyLog>()
let logs = try? modelContext.fetch(descriptor)
let data = try? JSONEncoder().encode(logs)
// Save to file
}
// Nuclear option - delete all data
func resetAllData(context: ModelContext) {
try? context.delete(model: UserProfile.self)
try? context.delete(model: FoodItem.self)
try? context.delete(model: Recipe.self)
try? context.delete(model: DailyLog.self)
try? context.delete(model: WeeklyPlan.self)
try? context.delete(model: ShoppingList.self)
try? context.save()
// Re-seed
SeedDataService.seedIfNeeded(context: context)
}
content_reports where status = 'pending'.hide_family_ugc(content_type, content_id, reason, report_id).update content_reports set status = 'actioned', reviewed_at = now() where id = … (or let hide_family_ugc do it when p_source_report_id is set).iCloud.com.agarcia.caluru).--verify-jwt; set OPENAI_API_KEY in Supabase. If 401: user must be signed in. If 500: check key.AccountResetService can clear data and optionally re-trigger onboarding (depends on implementation).