Cannot receive firebase analytics from IOS

653

Solution 1

Problem solved!

The problem was that I didn't have an IOS data stream in my project analytics property. All I had to do was to add a new IOS data stream and wait for analytics to show up after a day or two.

enter image description here Steps to create new data stream on GA4 analytics

Solution 2

Firebase events are batched together and uploaded once every hour in order to prevent excessive battery drain on the devices. On iOS when you background the app before the 1h upload target the events will be dispatched at this time in the background. Once the events are uploaded there is a delay at about 3h before the data will show up in the Firebase Analytics dashboard. Also, the default day range excludes "today" so you only see events from yesterday.

in some cases, you need to run it on a real device and wait for 24h to see your app in the console

You can use debug view to test your events

Share:
653
genericUser
Author by

genericUser

🔭 looking for knowledge to grab 🤓 🎯 Learn, Contribute and Grow 🌱

Updated on January 01, 2023

Comments

  • genericUser
    genericUser over 1 year

    I'm developing a Flutter application for both Android and IOS. I'm collecting analytics using firebase_analytics 8.2.0 package.

    I have configured my application as described at the package documentation. My Podfile starts with $FirebaseAnalyticsWithoutAdIdSupport = true.

    The problem is that I can only receive Android analytics.

    enter image description here

    My Code:

    final FirebaseAnalytics analytics = FirebaseAnalytics();
    
    void onGroupCreate(String groupId, double totalInvites, bool isStatus) {
          analytics.logEvent(
            name: "create_group",
            parameters: <String, dynamic>{
              'user_id': globals.user.userId,
              'group_id': groupId,
              'total_invites': totalInvites,
              'is_status': isStatus
            },
          );
        }
    

    My info.plist:

    <?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>CFBundleDevelopmentRegion</key>
        <string>$(DEVELOPMENT_LANGUAGE)</string>
        <key>CFBundleDisplayName</key>
        <string>AppName</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>AppName</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>$(MARKETING_VERSION)</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>com.googleusercontent.apps.####-#######</string>
                </array>
            </dict>
        </array>
        <key>CFBundleVersion</key>
        <string>$(CURRENT_PROJECT_VERSION)</string>
        <key>FirebaseAppDelegateProxyEnabled</key>
        <false/>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>NSContactsUsageDescription</key>
        <string>This app requires contacts access to function properly.</string>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>This app requires photos access to function properly.</string>
        <key>UIBackgroundModes</key>
        <array>
            <string>fetch</string>
            <string>remote-notification</string>
        </array>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
        <key>UIMainStoryboardFile</key>
        <string>Main</string>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
        </array>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false/>
    </dict>
    </plist>
    

    My GoogleService-Info.plist:

    <?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>CLIENT_ID</key>
        <string>####-######.apps.googleusercontent.com</string>
        <key>REVERSED_CLIENT_ID</key>
        <string>com.googleusercontent.apps.####-######</string>
        <key>ANDROID_CLIENT_ID</key>
        <string>####-######.apps.googleusercontent.com</string>
        <key>API_KEY</key>
        <string>####-######</string>
        <key>GCM_SENDER_ID</key>
        <string>####</string>
        <key>PLIST_VERSION</key>
        <string>1</string>
        <key>BUNDLE_ID</key>
        <string>######</string>
        <key>PROJECT_ID</key>
        <string>####-####</string>
        <key>STORAGE_BUCKET</key>
        <string>####-####.appspot.com</string>
        <key>IS_ADS_ENABLED</key>
        <false></false>
        <key>IS_ANALYTICS_ENABLED</key>
        <false></false>
        <key>IS_APPINVITE_ENABLED</key>
        <true></true>
        <key>IS_GCM_ENABLED</key>
        <true></true>
        <key>IS_SIGNIN_ENABLED</key>
        <true></true>
        <key>GOOGLE_APP_ID</key>
        <string>#:####:ios:######</string>
        <key>DATABASE_URL</key>
        <string>https://####-####.firebaseio.com</string>
    </dict>
    </plist>
    

    What can cause that problem? Why can't I receive IOS analytics?