Not work after upgrade to IOS 17 and Xcode 15
it was works problly with IOS and Android , but after update MY Xcode to 15.0 and my IOS to 17.0 it not work. I test it after update work with android but iOS not after upgrade .
This steps :
🔻add this in application function in AppDelegate.swift file:
FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
🔻add this function in AppDelegate.swift file:
private func registerPlugins(registry: FlutterPluginRegistry) {
if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
}
}
🔻In Runner in Target add labsqlite3.0.tbd under Frameworks,Libraries,and Embedded Content
🔻in main() function :
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize( debug: false, // optional: set to false to disable printing logs to console (default: true)
ignoreSsl: true // option: set to false to disable working with http links (default: false) );
🔻this Callback Function:
FlutterDownloader.registerCallback(downloadCallback);
@pragma('vm:entry-point')
static void downloadCallback(
String id, int status, int progress) {
print('progress $progress');
if (progress == 100) Constants.FILE_INSTALLED = true;
SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
send!.send([id, status, progress]);
}
🔻downloader enqueue function :
await FlutterDownloader.enqueue(
url: url,
savedDir: '${appDocDirectory.path}',
fileName:
'${url.substring(url.lastIndexOf('/'))}',
openFileFromNotification:
true, // click on notification to open downloaded file (for Android)
showNotification: false,
allowCellular: true,
);
I hope reach speed solution from you , Thanks🙏
🔻UPDATE When I downgrade version to 9.0.0 is work with IOS 17 , so please solve this issue with last version until we can use what you added in last update
Thanks🙏
@osama-hasanain the code above is your code ? so these are the steps you did and you had the issues wit iOS ?
@salmaahhmed yes right's
+1 have issue in logs : [VERBOSE-2:shell.cc(1004)] The 'vn.hunghd/downloader_background' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel. See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
IOS 17.0
@osama-hasanain can you upgrade to 1.11.4. and tell me if it's okay ?
1.11.4 here. Xcode Version 15.0.1 (15A507) and iOS 17, didn't work.
@sminrana can you show me the full file ?
I registered the plugin this way and it had no issues.
FlutterDownloaderPlugin.setPluginRegistrantCallback { registry in if (!registry.hasPlugin("FlutterDownloaderPlugin")) { FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!) } }
1.11.4 here. Xcode Version 15.0.1 (15A507) and iOS 17, didn't work.
you should move function registerPlugins out of AppDelegate scope, kind of make it 'top-level' in flutter terms
Thanks.
Adding @pragma('vm:entry-point') to the download callback method resolved the issues encountered on iOS 17.x.
@claptv Could you show me whole appdelegate file? it is not working one me still
