# App Configuration Guide

## Xcode Project Setup for TestFlight

### 1. Bundle Identifier
Change in Xcode:
- Target → General → Identity
- Bundle Identifier: `nl.yourcompany.airwave` (replace with your reverse domain)

### 2. Version & Build Numbers
- Target → General → Identity
- Version: `1.0.0`
- Build: `1`

### 3. App Icon
1. Create app icon (1024x1024px minimum)
2. Use an app icon generator or create all sizes manually:
   - 16x16, 32x32, 128x128, 256x256, 512x512, 1024x1024
3. Add to `Assets.xcassets/AppIcon.appiconset`

### 4. Signing & Capabilities

#### Enable Required Capabilities:
1. Target → Signing & Capabilities
2. Click `+ Capability` and add:
   - ✅ App Sandbox
   - ✅ Hardened Runtime

#### App Sandbox Settings:
```
Network:
  ✅ Outgoing Connections (Client)

File Access:
  ⬜ User Selected Files (only if adding import/export features)
```

#### Hardened Runtime Settings:
```
Runtime Exceptions:
  ⬜ Allow DYLD Environment Variables
  ⬜ Allow JIT Compilation
  ⬜ Disable Library Validation
  ⬜ Disable Executable Memory Protection
  
Resource Access:
  ✅ Audio Input (if using mic, otherwise leave unchecked)
  ⬜ Camera
  ⬜ Location
  ⬜ Address Book
  ⬜ Calendar
  ⬜ Photos Library
```

### 5. Info.plist Additions

Add these keys if not present:

```xml
<key>LSMinimumSystemVersion</key>
<string>14.0</string>

<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>

<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 Your Company. All rights reserved.</string>

<key>CFBundleShortVersionString</key>
<string>1.0.0</string>

<key>CFBundleVersion</key>
<string>1</string>
```

### 6. Build Settings

Important settings to verify:

```
Code Signing Identity: Apple Distribution
Development Team: [Your Team ID]
Provisioning Profile: Automatic (or select specific profile)

Build Active Architecture Only: NO (for release)
Enable Bitcode: NO (not needed for macOS)
Strip Debug Symbols During Copy: YES (for release)
```

### 7. Entitlements File

Create `AirWave.entitlements` if it doesn't exist:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.cs.allow-jit</key>
    <false/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <false/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <false/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <false/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <false/>
</dict>
</plist>
```

### 8. Scheme Configuration

1. Product → Scheme → Edit Scheme
2. For **Archive**:
   - Build Configuration: `Release`
   - ✅ Reveal Archive in Organizer

### 9. Pre-Submission Checklist

Run these tests:

```bash
# Clean build
⌘ + Shift + K

# Build for Release
⌘ + B (with scheme set to Release)

# Archive
Product → Archive
```

### 10. App Store Connect Setup

1. Go to https://appstoreconnect.apple.com
2. My Apps → + → New App
3. Fill in:
   - Platform: macOS
   - Name: AirWave
   - Primary Language: Dutch
   - Bundle ID: nl.yourcompany.airwave
   - SKU: unique identifier (e.g., airwave-mac-2026)
   - User Access: Full Access

### 11. TestFlight Beta Information

In App Store Connect → TestFlight:

**Beta App Description:**
```
AirWave is een eenvoudige internetradio-app voor je Mac.

Test alsjeblieft:
- Streams afspelen en stoppen
- Eigen stations toevoegen
- Categorieën beheren
- Media keys (play/pause)
- AirPlay (als je apparaten hebt)
- Standby gedrag
- Error handling (slechte URLs, geen internet)
```

**What to Test:**
```
- Stabiliteit van streaming
- Gebruiksvriendelijkheid
- Performance
- Crashes of bugs
- Ontbrekende functies
```

**Feedback Email:**
```
support@yourcompany.nl
```

### 12. Upload to App Store Connect

```bash
# Method 1: Using Xcode
1. Window → Organizer
2. Select your archive
3. Click "Distribute App"
4. Choose "TestFlight & App Store"
5. Follow prompts

# Method 2: Using Transporter app
1. Export archive as .pkg
2. Open Transporter
3. Drag .pkg to upload

# Method 3: Using command line
xcrun altool --upload-app --type macos --file "AirWave.pkg" \
  --apiKey YOUR_API_KEY --apiIssuer YOUR_ISSUER_ID
```

### 13. Post-Upload Steps

1. Wait for processing (usually 10-30 minutes)
2. Check for any issues in App Store Connect
3. Submit for Beta App Review (if required)
4. Add internal/external testers
5. Send test invitations

### Troubleshooting

**"Invalid Binary" error:**
- Check signing identity
- Verify entitlements
- Ensure all frameworks are signed
- Check for missing Info.plist keys

**"Missing compliance" message:**
- Go to App Store Connect
- Select build
- Answer export compliance questions
- Usually: "No" for encryption (unless you added custom encryption)

**Sandbox violations:**
- Review Console.app for sandbox errors
- Add required entitlements
- Remove any file system access outside allowed paths

### Support Resources

- Apple Developer Forums: https://developer.apple.com/forums/
- TestFlight Beta Testing: https://developer.apple.com/testflight/
- App Sandbox Guide: https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/
