Memory issues on iOS - ios

I'm currently working on optimizing my app.
When I'm monitoring the app's memory in DevTool it's showing around 20MB of memory usage.
However, when I'm running the same app via XCode, it's showing 250MB of memory usage or more and around the same value via Instruments or on an iOS app that shows the memory consumption on the device.
What could explain DevTool not showing the right values ?
Also I notice that during a pushAndReplace call, the dispose method was called but the used memory wasn't released.
Where should I look or what should I add to that method so that the page's widget are properly released ?
Thanks
flutter doctor -v
[✓] Flutter (Channel master, 3.5.0-12.0.pre.175, on macOS 12.6 21G115 darwin-x64, locale fr-FR)
• Flutter version 3.5.0-12.0.pre.175 on channel master at /Users/idm/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 92f10ed712 (9 days ago), 2022-11-08 17:57:52 -0800
• Engine revision e7d7edab98
• Dart version 2.19.0 (build 2.19.0-374.0.dev)
• DevTools version 2.19.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at /Users/idm/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• iPad (2) (mobile) • 0d90cccda2e8ecbf09cb57bbe0219aaf441b212d • ios • iOS 15.6 19G71
• macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

Related

Flutter Location Package: 'onLocationChanged' method listen changes but always return the same coordinates on IOS

Using location ^4.4.0 and listen location changes but always returning the same location coordinates on IOS.
Location location = Location();
location.onLocationChanged.listen((LocationData currentLocation) {
print('{"latitude": "${currentLocation.latitude}", "longitude": "${currentLocation.longitude}"}');
}
I've made the setup on IOS from the package and retrieving permissions with permission_handler package. On Android is working fine but on IOS always return the same coordinates.
The listen is working by retrieving data, but the coordinates should change because i'm testing it on a real device - iPhone XR with IOS 16.3.
** flutter doctor -v **
[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6 21G115 darwin-x64, locale en-PT)
• Flutter version 3.7.3 on channel stable at /Users/tiago/Code/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 9944297138 (6 days ago), 2023-02-08 15:46:04 -0800
• Engine revision 248290d6d5
• Dart version 2.19.2
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/tiago/Library/Android/sdk
• Platform android-33, build-tools 30.0.3
• ANDROID_HOME = /Users/tiago/Android/Sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.75.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
Any advice on that?

PhaseScriptExecution error but doesn't specify the problem

I know this problem already exists everywhere, but I tried most of the solutions of this and still none of them work. The log doesn't seem to specify what's the problem, only shows the said PhaseScriptExecution error.
What else can I do to solve this?
Tried running, re-running, deleting pods files, cleaning, rebuilding, etc.
I'm trying to run a flutter app in a physical device.
Also tried running in a clean project, but the same error persists.
XCode 13.4.1
MBPM1
flutter doctor -v :
Flutter (Channel master, 3.4.0-30.0.pre.19, on macOS 12.4 21F79 darwin-arm64, locale en-PT)
• Flutter version 3.4.0-30.0.pre.19 on channel master at /Users/henriqueguima/work/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f2c6033739 (4 months ago), 2022-09-26 03:50:27 -0400
• Engine revision 53a7659ea1
• Dart version 2.19.0 (build 2.19.0-240.0.dev)
• DevTools version 2.17.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/henriqueguima/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.74.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (3 available)
• iPhone (mobile) • 2c12eaae0fc97e504f295ea6cb964ab6904f42cd • ios • iOS 15.7.2 19H218
• macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
! Error: iPhone is busy: Making iPhone ready for development. Xcode will continue when iPhone is finished. (code -10)
[✓] HTTP Host Availability
• All required HTTP hosts are available
XCode log -- https://pastebin.com/r0RLjiAP
EDIT: downgrade didn't work either

Flutter - Can't run profile mode in emulator

When I run Profile mode in emulator for my flutter projects. this error happens
This is complete error message if i use --verbose
Here's my flutter doctor
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-x64, locale en-ID)
• Flutter version 3.3.2 on channel stable at /Users/prima/fvm/versions/stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e3c29ec00c (3 weeks ago), 2022-09-14 08:46:55 -0500
• Engine revision a4ff2c53d8
• Dart version 2.18.1
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/prima/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.71.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.48.0
[✓] Connected device (4 available)
• iPhone 14 Pro Max (mobile) • 08082184-3CF4-4E36-A3D4-73BB91B696DA • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
• iPhone 11 (mobile) • BFBBDCF6-254F-4F84-9E46-BDA5C9995C0D • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.6 21G115 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I've been looking for a solution and tried several ways but still can't get it to work.
Profile mode is disabled to running in emulators and simulators. If you would like to test anything in this mode you need a physical device.

Invalid Binary issue in flutter IOS build

So, yesterday I build an app for ios, archive it and upload it to AppStore connect through xcode, everything seemed good but after few moments I received an email from apple saying:
Dear Developer,
We identified one or more issues with a recent delivery for your app, "APP-NAME" 1.0.1 (2). Please correct the following issues, then upload again.
ITMS-90755: Invalid Binary - The following binaries in your app contains prohibited instructions: /Volumes/data01/app_data/awf/SWImportWorker-mr47p00ce-swpr0068.cse.apple.com-300252/ff03-SoftwareImportWorker-MR_.0/NYH74E2GDJSTMWPVXUPB4IZWH4/umuagyjihbsjsrpn/wspvjpsuvltmmknh/Payload/Runner.app/Frameworks/App.framework/App. Remove the instructions from the binaries, rebuild and resubmit.
Best regards,
The App Store Team
I tried again with flutter clean and also increased the IOS deployment target but it didn't help.
My device's Flutter info:
Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale
en-PK)
• Flutter version 2.5.0 at /Users/niteshkongreja/Development/flutter
• Upstream repository https://github.com/niteshcongreja321/flutter.git
• Framework revision 4cc385b4b8 (10 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/niteshkongreja/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/niteshkongreja/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.60.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 11.5.2 20G95 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
• No issues found!
All I had to do was revoke my certificate, delete the mobileprovision file, then recreate both.
I also changed over to Air SDK 3.7.0.1530 and included the Default-568h#2x.png for the iphone splash screen, and well... it seems to have worked.

How do I listen to a cloud firestore stream in iOS (works fine on Android)?

I can successfully read and write to a cloud firestore database from within my app. However, when running on an iOS simulator (or real device) I cannot listen to a stream for realtime changes to a document through Riverpod or standard StreamBuilder. No errors or exceptions are thrown when listening to the stream. The stream exists, it just doesn't have data in it. This problem DOES NOT exist when running on an Android emulator.
StreamProvider
final athletePosStreamProvider = StreamProvider<GPSPoint>((ref) {
final _fsDB = FirebaseFirestore.instance;
print('Provider is active');
return _fsDB.collection('Athlete1').doc('currentPosition').snapshots().map((document) {
print('stream data found');
return GPSPoint.fromFSMap(document.data());
});
});
Stream listen:
final athletePos = Provider<GPSPoint>((ref) {
GPSPoint _curPos;
print('athletePos is active');
Stream _docStream = FirebaseFirestore.instance.collection('Athlete1').doc('currentPosition').snapshots();
if (_docStream.isBroadcast == true) {
print('Stream is broadcasting');
}
_docStream.listen((event) {
print('athletePos stream event received');
_curPos = GPSPoint.fromFSMap(event.data());
});
return _curPos;
});
In both scenarios the first print statement fires, but the second print statement never fires on iOS. It will work correctly on Android.
pubspec.yaml
cloud_firestore: ^0.14.3+1
flutter_riverpod: ^0.12.1
flutter doctor
[✓] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US)
• Flutter version 1.24.0-10.2.pre at /Users/sgalway/development/flutter
• Framework revision 022b333a08 (11 days ago), 2020-11-18 11:35:09 -0800
• Engine revision 07c1eed46b
• Dart version 2.12.0 (build 2.12.0-29.10.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/sgalway/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Community Edition (version 2020.1.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 47.1.3
• Dart plugin version 201.7846.93
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (3 available)
• iPhone 11 Pro (mobile) • 21B0C3BA-D8B9-4AF2-81A5-FC8176E49F24 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.198
• No issues found!

Resources