Wednesday, November 11, 2026
HomeiOS Developmentswift - Exception whereas embedding flutter in present iOS Software

swift – Exception whereas embedding flutter in present iOS Software

[ad_1]

I’m attempting so as to add flutter in my iOS software however I’m dealing with Thread 1: EXC_BAD_ACCESS (code=1, tackle=0x7fe6223f8ff0) in my AppDelegate file whereas working in iOS Simulator and after working it a number of time once more this exception mechanically disappear.

Here’s what I’m doing in my didFinishLaunchingWithOptions in my AppDelegate file of iOS Mission:

import UIKit
import Basis
import TrueSDK
import GoogleMaps
import GooglePlaces
import MoEngage
import UserNotifications
import Firebase
import Department
import AppsFlyerLib
//import Mixpanel
import HyperSDK
import AppTrackingTransparency
import NewRelic
import FirebaseCrashlytics
import netfox
import Section
import Segment_MoEngage
import Flutter
import FlutterPluginRegistrant

@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
    var wireframe: ApplicationWireframe!
    let defaults = UserDefaults.customary
    let applicationIntercator = InteractorFactory.sharedInstance.getApplicationInterector()
    var appLaunchCount = 0
    lazy var flutterEngine:FlutterEngine = FlutterEngine(identify:Constants.FLUTTER_ENGINE_NAME, venture: nil)
    
    
    override func software(_ software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
#if DEBUG
        NFX.sharedInstance().begin()
        //    NFX.sharedInstance().setGesture(.customized)
#endif
        
        FirebaseApp.configure()

        let rcVal = RCValues.sharedInstance
        //New Relic
        let isNewRelicEnabled = rcVal.getValue(forKey: .is_new_relic_enabled_ios)
        if isNewRelicEnabled {
            NewRelic.begin(withApplicationToken:Setting.ThirdParty.NewRelicAppToken.translate())
        }
        
        let defaults = UserDefaults.customary
        let applaunchedCount = defaults.integer(forKey: Constants.APP_LAUNCH_COUNT)
        
        if applaunchedCount == 0 {
            self.appLaunchCount = self.appLaunchCount + 1
        } else {
            self.appLaunchCount = applaunchedCount + 1
        }
        defaults.set(appLaunchCount, forKey: Constants.APP_LAUNCH_COUNT)
        
        self.appLaunchCount = self.appLaunchCount + 1
        
        let moengageConfigAppId = Setting.ThirdParty.MoEngageAppKey.translate()
        var sdkConfig = MOSDKConfig.init(appID: moengageConfigAppId)
#if DEBUG
        MoEngage.sharedInstance().initializeTest(with: sdkConfig, andLaunchOptions: nil)
#else
        MoEngage.sharedInstance().initializeLive(with: sdkConfig, andLaunchOptions: nil)
#endif
        
        setupSegment()
        MOInApp.sharedInstance().present()
        MoEngage.setAppGroupID("-----")
        
        if defaults.object(forKey: "isInstallFirstTime") == nil {
            defaults.set("No", forKey:"isInstallFirstTime")
            defaults.synchronize()
//            MoEngage.sharedInstance().appStatus(INSTALL)
        }
//        MoEngage.sharedInstance().setUserMobileNo("(Util.getUserPhoneNumber())")
        //        MoEngage.debug(LOG_ALL)
        GMSServices.provideAPIKey(Setting.ThirdParty.GoogleServicesKey.translate())
        GMSPlacesClient.provideAPIKey(Setting.ThirdParty.GooglePlaceApiKey.translate())
        registerForRemoteNotifications()
        initialSetupForTrueCaller()
        defaults.set(UIDevice.present.identifierForVendor?.uuidString, forKey: Constants.DEVICE_ID)
        self.setUpAppsFlyer()
        self.setUpBranchIO(launchOptions: launchOptions)
        //        self.applicationIntercator.getTrackerUrlRequest { (end result, error) in }
        
        self.setupMixpanel()
        self.setUpJuspaySDK()
        self.initWindow(launchOptions: launchOptions)
        self.wireframe.showFirstScreen(forLaunchOptions: launchOptions as [UIApplication.LaunchOptionsKey: Any]?)
        self.setupFlutterEngine()

        return tremendous.software(software, didFinishLaunchingWithOptions: launchOptions);
    }
    
    personal func setupFlutterEngine() {
        self.flutterEngine.run(withEntrypoint: nil);
        GeneratedPluginRegistrant.register(with: self.flutterEngine);
    }
.
.
.
}

For launching view controller on click on of button

    func showFlutter() {
        
        let flutterEngine = ((UIApplication.shared.delegate as? AppDelegate)?.flutterEngine)!;
        let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil);
        self.navigationController?.pushViewController(flutterViewController, animated: true)
        let flutterDataChannel = FlutterMethodChannel(identify: Constants.FLUTTER_METHOD_CHANNEL_NAME, binaryMessenger: flutterViewController.binaryMessenger)
        
        let jsonObject: NSMutableDictionary = NSMutableDictionary()
        
        jsonObject.setValue("(getHeaders())", forKey: FlutterCallMethodEnum.header.rawValue)
        jsonObject.setValue("1001", forKey: FlutterCallMethodEnum.deepLink.rawValue)
        jsonObject.setValue(Util.getRefreshToken(), forKey: FlutterCallMethodEnum.refreshToken.rawValue)
        jsonObject.setValue(Apiurls.getRefreshTokenUrl(), forKey: FlutterCallMethodEnum.refreshUrl.rawValue)
        jsonObject.setValue(Util.getAuthToken(), forKey: FlutterCallMethodEnum.authToken.rawValue)
        jsonObject.setValue(Util.getUserId(), forKey:FlutterCallMethodEnum.userId.rawValue)
        
        var convertedString: String? = nil
        do {
            let data1 =  attempt JSONSerialization.information(withJSONObject: jsonObject, choices: JSONSerialization.WritingOptions.prettyPrinted)
            convertedString = String(information: data1, encoding: String.Encoding.utf8)
        } catch let myJSONError {
            print(myJSONError)
        }
        
        flutterDataChannel.invokeMethod("fromHostToClient", arguments: convertedString)
    }


Listed here are the logs I m getting in my console

2022-06-21 08:34:44.193502+0530 APP_NAME[25333:187559] nil host utilized in name to allowsSpecificHTTPSCertificateForHost
2022-06-21 08:34:44.193776+0530 APP_NAME[25333:187559] nil host utilized in name to allowsAnyHTTPSCertificateForHost:
2022-06-21 08:34:44.195247+0530 APP_NAME[25333:187559] nil host utilized in name to allowsSpecificHTTPSCertificateForHost
2022-06-21 08:34:44.195354+0530 APP_NAME[25333:187424] -allHeaderFields referred to as on NSURLResponse
2022-06-21 08:34:44.195467+0530 APP_NAME[25333:187559] nil host utilized in name to allowsAnyHTTPSCertificateForHost:
2022-06-21 08:34:44.196927+0530 APP_NAME[25333:187568] -allHeaderFields referred to as on NSURLResponse
2022-06-21 08:34:44.197143+0530 APP_NAME[25333:187559] nil host utilized in name to allowsSpecificHTTPSCertificateForHost
2022-06-21 08:34:44.197457+0530 APP_NAME[25333:187559] nil host utilized in name to allowsAnyHTTPSCertificateForHost:
2022-06-21 08:34:44.198888+0530 APP_NAME[25333:187558] -allHeaderFields referred to as on NSURLResponse
[NFX]: Didn't load information from [file:///Users/guest123/Library/Developer/CoreSimulator/Devices/F18AE14A-B8E0-4A52-8B8E-CD671AB20D56/data/Containers/Data/Application/F908D915-9E39-4C2D-85A3-49BE797E265E/tmp/NFX/request_body_8:34_3DC2B849-80B1-4DAB-AD2E-564677BD7B5B] - The file “request_body_8/34_3DC2B849-80B1-4DAB-AD2E-564677BD7B5B” couldn’t be opened as a result of there isn't a such file.


[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments