Buy

Flutter IOS Setup

1.Introduction

In this article, we are going to set up the Restart App’s initial setup for real-time use cases.

2.Setup Instructions

  • Note: Before ios setup, please complete all the server & firebase & code changes, map setup which is mentioned in android setup & server setup sections.
  • flutter version for this project is 'Channel stable, 3.29.2'
    • change some details in given files,
    • 
      <strong>Note:</strong> File Location: "project/ios/Runner/Runner.xcodeproj/project.pbxproj"
      

    
    PRODUCT_BUNDLE_IDENTIFIER = 'your bundle id here';  (change in 6 places in same file)
    DEVELOPMENT_TEAM = 'team id'; (change your apple team id here 3 places)
    INFOPLIST_KEY_CFBundleDisplayName = 'product name'; (change your app name here 3 places)
    

  • Note : File Location : "project/ios/Runner/info.plist"

  • 
    <key> CFBundleDisplayName </key>
    
    <string>project name here </string>
    
    <array>
    <string>Encoded app id from firebasse </string>
    </array>
    
    

  • Replace"Encoded app id from firebasse" with the encoded app id of Firebase project
  • Open your project File with the Xcode IDE which is used to create the project and also it is very powerful. project file is in location,
  • Note : File Location : "project/ios/runner.xcworkspace"

change map api key in file, Note : File Location : project/ios/Runner/appDelegate.swift



GMSServices.provideAPIKey("your map key here")


3.Major things to Do:


  1. Rename the project with your app name and bundle identifier
    in Xcode / Runner / General /
  2. Create a bundle identifier for your app in developer account.
  3. create development and distribution certificates.kindly refer this url for reference - https://medium.com/mobile-devops-ci-cd-ct/steps-to-create-ios-developer-and-distribution-certificates-with-and-without-a-mac-8449b973ef9d
  4. Create provisioning profiles for both development and distribution. kindly refer this url for reference - https://clearbridgemobile.com/how-to-create-a-distribution-provisioning-profile-for-ios/
  5. Create APNS auth key for push notification.
  6. Register your bundle identifier in firebase project that you changed in xcode.
  7. Firebase -: setup phone number authentication, cloud messaging and firebase database.
  8. Download the googleservicePlist json from firebase.
  9. Now open the project.
  10. add googleservice-Info.plist in project/ios/Runner/ or from xcode right click Runner and click Add files to runner and choose googleserviceInfo.plist file as shown in image.
  11. after open the google-services.json file, and find out the "API_KEY","GOOGLE_APP_ID","PROJECT_ID","GCM_SENDER_ID"
  12. replace these key values in "project/lib/common/app_constant.dart" file
  13. (GCM_SENDER_ID as firebasemessagingSenderId, GOOGLE_APP_ID as firebaseAppId)
  14. copy the google app id from googleserviceplist.json and paste it in url scheme in Xcode / Runner / Info / url types as shown in image
  15. in go to folder 'project/ios' and run command 'flutter build ios --release -target lib/env/main_dev.dart'
  16. to create archive file to upload run command 'flutter build ipa' from folder 'project/ios'.
  17. you will find archive file in folder project/build/ios/archive/Runner.xcarchive