-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Guide
Complete setup instructions for AgriSense iOS development environment.
- macOS: 13.0 (Ventura) or later
- Xcode: 15.0 or later
- iOS Deployment Target: iOS 16.0+
- RAM: Minimum 8GB (16GB recommended)
- Disk Space: At least 10GB free space
-
Xcode
# Install from Mac App Store or download from # https://developer.apple.com/xcode/ # Verify installation xcodebuild -version
-
Command Line Tools
xcode-select --install
-
Git
# Check if Git is installed git --version # If not installed, it will prompt for installation
-
CocoaPods (Optional, if needed for dependencies)
sudo gem install cocoapods pod --version
# Clone the repository
git clone https://github.com/Athar891/AgrisenseiOS.git
# Navigate to project directory
cd AgrisenseiOS
# Check current branch
git branch- Go to Firebase Console
- Create a new project or use existing one
- Add iOS app to your Firebase project
- Download
GoogleService-Info.plist
# Place GoogleService-Info.plist in Agrisense folder
cp ~/Downloads/GoogleService-Info.plist ./Agrisense/Important: Ensure GoogleService-Info.plist is added to Xcode target:
- Open Xcode
- Drag
GoogleService-Info.plistto Agrisense folder - Check "Copy items if needed"
- Select Agrisense target
-
Authentication
- Email/Password provider
- Google Sign-In provider
- Phone authentication (optional)
-
Cloud Firestore
- Create database in production mode
- Set up security rules (see Firebase Integration)
-
Cloud Storage
- Enable storage bucket
- Configure storage rules
-
Cloud Functions (if using)
- Set up Node.js functions
Create Secrets.swift in Agrisense/Models/ directory:
// Agrisense/Models/Secrets.swift
import Foundation
enum Secrets {
// OpenWeatherMap API Key
static let weatherAPIKey = "YOUR_OPENWEATHER_API_KEY"
// Google Gemini AI API Key
static let geminiAPIKey = "YOUR_GEMINI_API_KEY"
// Cloudinary Configuration
static let cloudinaryCloudName = "YOUR_CLOUD_NAME"
static let cloudinaryUploadPreset = "YOUR_UPLOAD_PRESET"
// Government Data API (if required)
static let govDataAPIKey = "YOUR_GOV_DATA_API_KEY" // Optional
}-
OpenWeatherMap API
- Sign up at OpenWeatherMap
- Navigate to API Keys section
- Copy your API key
-
Google Gemini AI API
- Visit Google AI Studio
- Sign in with Google account
- Create API key
- Copy the API key
-
Cloudinary
- Sign up at Cloudinary
- Go to Dashboard
- Note your Cloud Name
- Create an unsigned upload preset:
- Settings β Upload β Upload presets
- Add upload preset (unsigned)
-
Government Data API (Optional)
- Visit data.gov.in
- Register for API access
- Request API key
- Go to Google Cloud Console
- Select your Firebase project
- Navigate to APIs & Services β Credentials
- Create OAuth 2.0 Client ID:
- Application Type: iOS
- Bundle ID:
com.yourcompany.agrisense - Download the configuration
Add URL scheme to Agrisense/Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.YOUR-CLIENT-ID</string>
</array>
</dict>
</array>- Open project in Xcode
- Select Agrisense target
- Go to Signing & Capabilities
- Update Bundle Identifier to your unique identifier
- Select your development team
-
Background Modes
- Audio, AirPlay, and Picture in Picture
- Background fetch
- Remote notifications
-
Push Notifications
- Enable push notifications capability
-
App Groups (if using)
- Add app group identifier
# Open the project
open Agrisense.xcodeproj- In Xcode, select scheme: Agrisense
- Select target device or simulator
- Recommended: iPhone 14 Pro or later simulator
The project uses Swift Package Manager for dependencies. Xcode will automatically resolve packages on first build.
If you encounter issues:
# In Xcode
File β Packages β Reset Package Caches
File β Packages β Resolve Package VersionsOption 1: Using Xcode
- Press
βB(Command + B) to build - Press
βR(Command + R) to build and run
Option 2: Using Command Line
# Build for simulator
xcodebuild -project Agrisense.xcodeproj \
-scheme Agrisense \
-sdk iphonesimulator \
-configuration Debug \
build
# Or use the task (if configured)
# See .vscode/tasks.json# List available simulators
xcrun simctl list devices
# Boot a simulator
xcrun simctl boot "iPhone 14 Pro"
# Run the app
xcodebuild -project Agrisense.xcodeproj \
-scheme Agrisense \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 14 Pro' \
build- Connect device via USB
- Trust computer on device
- Select device in Xcode
-
Enable Developer Mode on iOS device:
- Settings β Privacy & Security β Developer Mode
-
Build and Run (
βR)
After installation, verify:
-
App Launches β
- No crashes on launch
- Splash screen appears
-
Authentication β
- Email/Password sign-up works
- Google Sign-In works
- Sign-out functionality
-
Firebase Connection β
- Check Xcode console for Firebase initialization logs
- Test Firestore read/write
-
API Integration β
- Weather data loads
- Market prices fetch successfully
-
AI Assistant β
- Voice recognition activates
- Gemini AI responds correctly
Look for these success messages in Xcode console:
β
Firebase configured successfully
β
Google Sign-In initialized
β
Location services authorized
β
Weather data fetched
β
Gemini AI service ready
Solution:
# Clear derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# Reset package caches in Xcode
File β Packages β Reset Package CachesSolution:
- Verify file is in
Agrisense/directory - Check file is added to Agrisense target
- Clean build folder (
ββ§K) - Rebuild project
Solution:
- Go to Signing & Capabilities
- Enable "Automatically manage signing"
- Select your team
- Change bundle identifier if needed
Solution:
# Kill all simulator processes
killall Simulator
# Reset simulator
xcrun simctl erase all
# Reboot simulator
xcrun simctl boot "iPhone 14 Pro"Solution:
- Verify
GoogleService-Info.plistis correct - Check Firebase project settings
- Ensure bundle ID matches Firebase configuration
- Check internet connection
# In Xcode
File β Packages β Update to Latest Package Versions# Check for Firebase updates
# Xcode will notify of available updates
# Or manually update in Package DependenciesAfter successful installation:
- Quick Start Guide - Build your first feature
- Project Architecture - Understand the codebase
- Contributing Guide - Start contributing
-
Use Simulator Shortcuts:
-
βK- Toggle keyboard -
ββ- Rotate right -
ββ§H- Home button
-
-
Debug Efficiently:
- Enable Zombie Objects for memory debugging
- Use View Debugger (
Debug β View Debugging β Capture View Hierarchy) - Profile with Instruments (
βI)
-
Version Control:
- Create feature branches for development
- Commit frequently with meaningful messages
- Pull latest changes regularly
If you encounter issues:
- Check Troubleshooting Guide
- Search GitHub Issues
- Create new issue with:
- Xcode version
- iOS version
- Error messages
- Steps to reproduce
Ready to start developing? β Quick Start Guide