On this page14 sections
Lecture 003: Adding the iOS App
| Category | 1: Firebase Setup |
| Lecture | 003 of 014 |
| Estimated video length | 14 min |
| Target | Flutter 3.44 · Dart 3.12 · FlutterFire (latest) · Xcode 26 |
| Level | Intermediate |
The same Firebase project serves iOS too. We register the iOS app, add its config file in Xcode, and set the minimum iOS version.
Contents
Prerequisites · Objectives · Lesson · Code Examples · Common Mistakes · Best Practices · Practice Questions · Answers · Takeaways · Full Code
Prerequisites
Lecture 001: the Firebase project. A Mac with Xcode installed.
Learning Objectives
- Find the iOS bundle ID
- Register the iOS app in Firebase
- Add
GoogleService-Info.plistto the Runner target in Xcode - Set the iOS deployment target
- Know which
Info.plistkeys are optional
1. Find the Bundle ID
iOS identifies an app by its bundle ID. Open ios/Runner.xcworkspace in Xcode → select
Runner (the blue project icon) → Signing & Capabilities → Bundle Identifier.
It is usually the same as the Android package name: com.example.notify_demo. Set your real
one now.
2. Register the iOS App
- Firebase console → Project overview → Add app → the iOS+ icon.
- Enter the bundle ID exactly as in Xcode.
- Register app → Download GoogleService-Info.plist.
- Skip the remaining steps: the Swift package and code they show are for native apps. The FlutterFire packages do this for you.
3. Add the File in Xcode
The file must be added through Xcode, not just copied in Finder, so it is included in the build:
- In Xcode's left panel, right-click the Runner folder → Add Files to "Runner"…
- Pick
GoogleService-Info.plist. - Tick Copy items if needed and make sure the Runner target is ticked.
- Add.
It now sits in ios/Runner/GoogleService-Info.plist.
4. Deployment Target
Current Firebase versions need iOS 15 or later. Set it in two places:
- Xcode → Runner target → General → Minimum Deployments →
15.0 ios/Podfile, top line:
platform :ios, '15.0'5. Optional Info.plist Keys
You'll see this key in some guides:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>It allows plain-http connections to local network addresses: the iOS twin of Android's
usesCleartextTraffic. Firebase doesn't need it; add it only if your app talks to a local
http:// server while testing.
Code Examples
Example 1: Build for iOS
cd ios
pod install --repo-update
cd ..
flutter run -d "iPhone 17 Pro"pod install downloads the native Firebase libraries the FlutterFire packages will need. The
app should start in the simulator as before.
Common Beginner Mistakes
1. File copied in Finder only: it's in the folder but not in the build. Firebase then fails with "Could not locate configuration file: 'GoogleService-Info.plist'". Add it via Xcode.
2. Bundle ID mismatch: the ID in Firebase must equal Xcode's Bundle Identifier exactly.
3. Old deployment target: pod install fails with "required a higher minimum deployment
target". Raise both the Podfile and Xcode settings.
Best Practices
- Use the same identifier for Android and iOS when you can: it keeps things simple.
- Open
Runner.xcworkspace, neverRunner.xcodeproj, when CocoaPods are in use. - Commit the Podfile change so the whole team builds with the same target.
Practice Questions
- Where do you find the iOS bundle ID?
- Why must
GoogleService-Info.plistbe added through Xcode? - What minimum iOS version do current Firebase versions need?
- Does Firebase need
NSAllowsLocalNetworking?
Practice Answers
- Xcode → Runner target → Signing & Capabilities → Bundle Identifier.
- So it's part of the Runner target and copied into the app.
- iOS 15.
- No: only for plain-http local servers.
Key Takeaways
- Register the iOS app with the exact bundle ID.
- Add
GoogleService-Info.plistto the Runner target via Xcode. - Set iOS 15+ in Xcode and the Podfile, then
pod install. - App Transport Security keys are for local http servers, not Firebase.
Full Code (Copy-Paste Reference)
No Dart code yet: the only file to copy is the Podfile line.
ios/Podfile (top line)
platform :ios, '15.0'That, plus GoogleService-Info.plist added to the Runner target through Xcode (Section 3),
completes the native iOS side. Firebase.initializeApp() on the Dart side arrives in
Lecture 004.