Implement checkPermissionStatus() and requestNotificationPermissions() methods for iOS plugin, matching Android functionality. Fix compilation errors across plugin files and add comprehensive build/test infrastructure. Key Changes: - Add checkPermissionStatus() and requestNotificationPermissions() methods - Fix 13+ categories of Swift compilation errors (type conversions, logger API, access control, async/await, etc.) - Create DailyNotificationScheduler, DailyNotificationStorage, DailyNotificationStateActor, and DailyNotificationErrorCodes components - Fix CoreData initialization to handle missing model gracefully for Phase 1 - Add iOS test app build script with simulator auto-detection - Update directive with lessons learned from build and permission work Build Status: ✅ BUILD SUCCEEDED Test App: ✅ Ready for iOS Simulator testing Files Modified: - doc/directives/0003-iOS-Android-Parity-Directive.md (lessons learned) - ios/Plugin/DailyNotificationPlugin.swift (Phase 1 methods) - ios/Plugin/DailyNotificationModel.swift (CoreData fix) - 11+ other plugin files (compilation fixes) Files Added: - ios/Plugin/DailyNotificationScheduler.swift - ios/Plugin/DailyNotificationStorage.swift - ios/Plugin/DailyNotificationStateActor.swift - ios/Plugin/DailyNotificationErrorCodes.swift - scripts/build-ios-test-app.sh - scripts/setup-ios-test-app.sh - test-apps/ios-test-app/ (full test app) - Multiple Phase 1 documentation files
4.2 KiB
4.2 KiB
iOS Test App Setup Guide
Status: 📋 SETUP REQUIRED
Objective: Create iOS test app for Phase 1 testing
Problem
The iOS test app (test-apps/ios-test-app/) does not exist yet. This guide will help you create it.
Quick Setup
Option 1: Automated Setup (Recommended)
Run the setup script:
./scripts/setup-ios-test-app.sh
This will:
- Create basic directory structure
- Copy HTML from Android test app
- Create
capacitor.config.jsonandpackage.json - Set up basic files
Option 2: Manual Setup
Follow the steps below to create the iOS test app manually.
Manual Setup Steps
Step 1: Create Directory Structure
cd test-apps
mkdir -p ios-test-app/App/App/Public
cd ios-test-app
Step 2: Initialize Capacitor
# Create package.json
cat > package.json << 'EOF'
{
"name": "ios-test-app",
"version": "1.0.0",
"description": "iOS test app for DailyNotification plugin",
"scripts": {
"sync": "npx cap sync ios",
"open": "npx cap open ios"
},
"dependencies": {
"@capacitor/core": "^5.0.0",
"@capacitor/ios": "^5.0.0"
}
}
EOF
# Install dependencies
npm install
# Add iOS platform
npx cap add ios
Step 3: Copy HTML from Android Test App
# Copy HTML file
cp ../android-test-app/app/src/main/assets/public/index.html App/App/Public/index.html
Step 4: Configure Capacitor
Create capacitor.config.json:
{
"appId": "com.timesafari.dailynotification.test",
"appName": "DailyNotification Test App",
"webDir": "App/App/Public",
"server": {
"iosScheme": "capacitor"
},
"plugins": {
"DailyNotification": {
"enabled": true
}
}
}
Step 5: Configure Info.plist
Edit App/App/Info.plist and add:
<!-- Background Task Identifiers -->
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.timesafari.dailynotification.fetch</string>
<string>com.timesafari.dailynotification.notify</string>
</array>
<!-- Background Modes -->
<key>UIBackgroundModes</key>
<array>
<string>background-fetch</string>
<string>background-processing</string>
<string>remote-notification</string>
</array>
<!-- Notification Permissions -->
<key>NSUserNotificationsUsageDescription</key>
<string>This app uses notifications to deliver daily updates and reminders.</string>
Step 6: Link Plugin
The plugin needs to be accessible. Options:
Option A: Local Development (Recommended)
- Ensure plugin is at
../../ios/Plugin/ - Capacitor will auto-detect it during sync
Option B: Via npm
- Install plugin:
npm install ../../ - Capacitor will link it automatically
Step 7: Sync Capacitor
npx cap sync ios
Step 8: Build and Run
# Use build script
../../scripts/build-ios-test-app.sh --simulator
# Or open in Xcode
npx cap open ios
# Then press Cmd+R in Xcode
Troubleshooting
Issue: "No Xcode workspace or project found"
Solution: Run npx cap add ios first to create the Xcode project.
Issue: Plugin not found
Solution:
- Ensure plugin exists at
../../ios/Plugin/ - Run
npx cap sync ios - Check
App/App/capacitor.plugins.jsoncontains DailyNotification entry
Issue: BGTask not running
Solution:
- Verify Info.plist has
BGTaskSchedulerPermittedIdentifiers - Check task registered in AppDelegate
- Use simulator-only LLDB command to manually trigger (see testing guide)
Issue: Build failures
Solution:
- Run
pod installinApp/directory - Clean build folder in Xcode (Cmd+Shift+K)
- Verify Capacitor plugin path
Verification Checklist
After setup, verify:
test-apps/ios-test-app/directory existsApp.xcworkspaceorApp.xcodeprojexistsApp/App/Public/index.htmlexistscapacitor.config.jsonexistsInfo.plisthas BGTask identifiers- Plugin loads in test app
- Build script works:
./scripts/build-ios-test-app.sh --simulator
References
- Requirements:
doc/test-app-ios/IOS_TEST_APP_REQUIREMENTS.md - Testing Guide:
doc/IOS_PHASE1_TESTING_GUIDE.md - Build Script:
scripts/build-ios-test-app.sh - Setup Script:
scripts/setup-ios-test-app.sh
Status: 📋 SETUP REQUIRED
Last Updated: 2025-01-XX