flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

IOS APP CRASHES

Open basnetjiten opened this issue 3 years ago • 5 comments

FBSDKLog: Missing [FBSDKAppEvents appEventsState.appID] for [FBSDKAppEvents flushOnMainQueue:] 2021-09-07 10:20:05.929659+0545 Runner[91079:784497] startBackgroundIsolate 2021-09-07 10:20:05.932307+0545 Runner[91079:784497] *** Assertion failure in -[FlutterDownloaderPlugin startBackgroundIsolate:], FlutterDownloaderPlugin.m:127 2021-09-07 10:20:05.965536+0545 Runner[91079:784497] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins' *** First throw call stack: ( 0 CoreFoundation 0x00007fff20421af6 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2042191f +[NSException raise:format:] + 0 3 Foundation 0x00007fff2077156a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 flutter_downloader 0x000000010c5d2f70 -[FlutterDownloaderPlugin startBackgroundIsolate:] + 528 5 flutter_downloader 0x000000010c5d8d89 -[FlutterDownloaderPlugin initializeMethodCall:result:] + 297 6 flutter_downloader 0x000000010c5dcb5f -[FlutterDownloaderPlugin handleMethodCall:result:] + 191 7 Flutter 0x000000010cf827ac __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104 8 Flutter 0x000000010cc04c5c _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166 9 Flutter 0x000000010cc09e4e _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38 10 Flutter 0x000000010cfad50f _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_38NS_9allocatorIS8_EEFvvEEclEv + 83 11 Flutter 0x000000010cf2b918 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 160 12 Flutter 0x000000010cf30694 ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0 + 26 13 CoreFoundation 0x00007fff20390c57 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20 14 CoreFoundation 0x00007fff2039072a __CFRunLoopDoTimer + 926 15 CoreFoundation 0x00007fff2038fcdd __CFRunLoopDoTimers + 265 16 CoreFoundation 0x00007fff2038a35e __CFRunLoopRun + 1949 17 CoreFoundation 0x00007fff203896d6 CFRunLoopRunSpecific + 567 18 GraphicsServices 0x00007fff2c257db3 GSEventRunModal + 139 19 UIKitCore 0x00007fff24696cf7 -[UIApplication _run] + 912 20 UIKitCore 0x00007fff2469bba8 UIApplicationMain + 101 21 Runner 0x000000010bacc4bb main + 75 22 libdyld.dylib 0x00007fff2025a3e9 start + 1 23 ??? 0x0000000000000001 0x0 + 1 )

basnetjiten avatar Sep 07 '21 04:09 basnetjiten

+1

LeoFavor1562 avatar Jan 06 '22 13:01 LeoFavor1562

+1

lijing89 avatar Jan 13 '22 05:01 lijing89

+1 Hi everyone, are there any updates for this issue?

nhatbui23988 avatar Mar 01 '22 07:03 nhatbui23988

why call registerWithRegistrar again?

yimao009 avatar Apr 25 '22 09:04 yimao009

Copy paste these files AppDelegate.m and AppDelegate.swift:

// AppDelegate.m
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#include "FlutterDownloaderPlugin.h"

@implementation AppDelegate

void registerPlugins(NSObject<FlutterPluginRegistry>* registry) {
  if (![registry hasPlugin:@"FlutterDownloaderPlugin"]) {
     [FlutterDownloaderPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterDownloaderPlugin"]];
  }
}

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  [FlutterDownloaderPlugin setPluginRegistrantCallback:registerPlugins];
  // Override point for customization after application launch.
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end
// AppDelegate.swift
import UIKit
import Flutter
import flutter_downloader

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

private func registerPlugins(registry: FlutterPluginRegistry) {
    if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
       FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
    }
}import UIKit
import Flutter
import flutter_downloader

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

private func registerPlugins(registry: FlutterPluginRegistry) {
    if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
       FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
    }
}

Then execute these commands: flutter clean flutter pub get flutter run

Ruslanbek0809 avatar Sep 19 '22 06:09 Ruslanbek0809

Make sure you've set up the plugin correctly.

bartekpacia avatar Mar 12 '23 15:03 bartekpacia