flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Not work after upgrade to IOS 17 and Xcode 15

Open osama-hasanain opened this issue 2 years ago • 12 comments

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🙏

osama-hasanain avatar Oct 04 '23 14:10 osama-hasanain

🔻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 avatar Oct 05 '23 09:10 osama-hasanain

@osama-hasanain the code above is your code ? so these are the steps you did and you had the issues wit iOS ?

salmaahhmed avatar Oct 05 '23 09:10 salmaahhmed

@salmaahhmed yes right's

osama-hasanain avatar Oct 05 '23 13:10 osama-hasanain

+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

Vrungel322 avatar Oct 10 '23 13:10 Vrungel322

@osama-hasanain can you upgrade to 1.11.4. and tell me if it's okay ?

salmaahhmed avatar Oct 18 '23 11:10 salmaahhmed

1.11.4 here. Xcode Version 15.0.1 (15A507) and iOS 17, didn't work. Screenshot 2023-10-25 at 12 12 38 AM

smnafiz avatar Oct 24 '23 18:10 smnafiz

@sminrana can you show me the full file ?

salmaahhmed avatar Oct 25 '23 07:10 salmaahhmed

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")!) } }

smnafiz avatar Oct 25 '23 13:10 smnafiz

1.11.4 here. Xcode Version 15.0.1 (15A507) and iOS 17, didn't work. Screenshot 2023-10-25 at 12 12 38 AM

you should move function registerPlugins out of AppDelegate scope, kind of make it 'top-level' in flutter terms

qwertylolman avatar Oct 26 '23 18:10 qwertylolman

Thanks.

smnafiz avatar Oct 26 '23 19:10 smnafiz

Adding @pragma('vm:entry-point') to the download callback method resolved the issues encountered on iOS 17.x.

claptv avatar Dec 01 '23 07:12 claptv

@claptv Could you show me whole appdelegate file? it is not working one me still

Lazizbek97 avatar Jan 25 '24 07:01 Lazizbek97