loup-v / streams_channel

For Flutter plugin development: StreamsChannel is inspired from EventChannel. It allows to create streams of events between Flutter and platform side.
Apache License 2.0
39 stars 23 forks source link

Can't catch error #7

Open followthemoney1 opened 4 years ago

followthemoney1 commented 4 years ago

Error

image image
2020-10-10 12:27:20.588951+0300 SportsU[458:23755] Metal API Validation Enabled
2020-10-10 12:27:20.709873+0300 SportsU[458:23755] Could not load the "LaunchImage" image referenced from a nib in the bundle with identifier "com.sportu"
(lldb) po registrar
▿ Optional<FlutterPluginRegistrar>
  - some : <FlutterEngineRegistrar: 0x281fa2820>

2020-10-10 12:32:44.109497+0300 SportsU[458:23755] FBSDKLog: Unable to obtain a key window, marking <UIWindow: 0x1057343c0; frame = (0 0; 375 667); hidden = YES; gestureRecognizers = <NSArray: 0x281114060>; layer = <UIWindowLayer: 0x281fc90a0>> as keyWindow
2020-10-10 12:32:44.137693+0300 SportsU[458:24782] [branch.io] Branch.m(195) Log: Branch version 0.35.0 started at 2020-10-10 09:32:44 +0000.
Branch Check Apple ADS active: true
Branch Apple ADS - delayInitToCheckForSearchAds
2020-10-10 12:32:44.196970+0300 SportsU[458:23961] [] tcp_input [C1.1:3] flags=[R] seq=2843741582, ack=0, win=0 state=CLOSE_WAIT rcv_nxt=2843741583, snd_una=890299954
2020-10-10 12:32:44.214482+0300 SportsU[458:23959] [branch.io] BNCServerInterface.m(415) Debug: URL: https://api2.branch.io/v1/open.
2020-10-10 12:32:44.214962+0300 SportsU[458:24782] [branch.io] BNCServerInterface.m(419) Debug: Body: {
    "ad_tracking_enabled" = 1;
    "app_version" = "1.0.12";
    "apple_ad_attribution_checked" = 0;
    "apple_testflight" = 1;
    "branch_key" = "key_live_keKWSdRdY1CQLhWDyvK4ikipBxhYaCF4";
    brand = Apple;
    build = 17H35;
    cd =     {
        mv = "-1";
        pn = "com.sportu";
    };
    "connection_type" = wifi;
    country = UA;
    "cpu_type" = 16777228;
    debug = 0;
    "device_carrier" = "Vodafone UA";
    "device_fingerprint_id" = 831202073307723695;
    environment = "FULL_APP";
    "facebook_app_link_checked" = 0;
    "first_install_time" = 1599412228448;
    "hardware_id" = "1F348E14-3646-4961-8A91-713D9F9187A4";
    "hardware_id_type" = idfa;
    "identity_id" = 843395487201180260;
    "ios_bundle_id" = "com.sportu";
    "ios_team_id" = NBKC2SRURE;
    "ios_vendor_id" = "31FECC9D-0E05-45D1-8722-534B8501DA8F";
    "is_hardware_id_real" = 1;
    language = en;
    "lastest_update_time" = 1602322026000;
    "latest_install_time" = 1602319299852;
    "local_ip" = "192.168.0.103";
    locale = "en_UA";
    model = "iPhone8,1";
    os = iOS;
    "os_version" = "13.7";
    "previous_update_time" = 1602321892000;
    retryNumber = 0;
    "screen_dpi" = 2;
    "screen_height" = 1334;
    "screen_width" = 750;
    sdk = "ios0.35.0";
    update = 0;
    "uri_scheme" = sportu;
    "user_agent" = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
}
JSON: {"device_carrier":"Vodafone UA","os_version":"13.7","ios_bundle_id":"com.sportu","debug":false,"screen_dpi":2,"country":"UA","is_hardware_id_real":true,"ios_team_id":"NBKC2SRURE","locale":"en_UA","ad_tracking_enabled":true,"device_fingerprint_id":"831202073307723695","sdk":"ios0.35.0","uri_scheme":"sportu","environment":"FULL_APP","connection_type":"wifi","previous_update_time":1602321892000,"retryNumber":0,"facebook_app_link_checked":false,"lastest_update_time":1602322026000,"local_ip":"192.168.0.103","brand":"Apple","update":0,"cd":{"pn":"com.sportu","mv":"-1"},"cpu_type":"16777228","screen_height":1334,"apple_ad_attribution_checked":false,"model":"iPhone8,1","branch_key":"key_live_keKWSdRdY1CQLhWDyvK4ikipBxhYaCF4","user_agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148","first_install_time":1599412228448,"hardware_id":"1F348E14-3646-4961-8A91-713D9F9187A4","os":"iOS","identity_id":"843395487201180260","hardware_id_type":"idfa","latest_install_time":1602319299852,"screen_width":750,"build":"17H35","language":"en","ios_vendor_id":"31FECC9D-0E05-45D1-8722-534B8501DA8F","app_version":"1.0.12","apple_testflight":true}.
2020-10-10 12:32:44.215851+0300 SportsU[458:24782] [branch.io] BNCNetworkService.m(210) Debug: Network start operation https://api2.branch.io/v1/open.
2020-10-10 12:32:44.286701+0300 SportsU[458:23977] flutter: Observatory listening on http://127.0.0.1:59059/-D3SH_GrsVQ=/
2020-10-10 12:32:44.360569+0300 SportsU[458:23963] 6.26.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
2020-10-10 12:32:44.381529+0300 SportsU[458:23963] 6.26.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2020-10-10 12:32:44.605840+0300 SportsU[458:24780] [branch.io] BNCNetworkService.m(205) Debug: Network finish operation https://api2.branch.io/v1/open 0.391s. Status 200 error (null).
{"session_id":"843408003974068757","identity_id":"843395487201180260","link":"https://6dqdj.app.link?%24identity_id=843395487201180260","data":"{\"+clicked_branch_link\":false,\"+is_first_session\":false}","device_fingerprint_id":"831202073307723695"}.
2020-10-10 12:32:44.606053+0300 SportsU[458:24780] [branch.io] BNCServerInterface.m(475) Debug: Server returned: Status: 200; Data: {
    data = "{\"+clicked_branch_link\":false,\"+is_first_session\":false}";
    "device_fingerprint_id" = 831202073307723695;
    "identity_id" = 843395487201180260;
    link = "https://6dqdj.app.link?%24identity_id=843395487201180260";
    "session_id" = 843408003974068757;
}.
Branch InitSession params: Optional(["+clicked_branch_link": 0, "+is_first_session": 0])
2020-10-10 12:32:44.708783+0300 SportsU[458:24788] [branch.io] BNCNetworkService.m(210) Debug: Network start operation https://cdn.branch.io/sdk/uriskiplist_v2.json.
2020-10-10 12:32:44.811196+0300 SportsU[458:23961] [] tcp_input [C2.1:3] flags=[R] seq=2058382919, ack=0, win=0 state=CLOSED rcv_nxt=2058382919, snd_una=204324094
2020-10-10 12:32:44.839921+0300 SportsU[458:23961] [] tcp_input [C2.1:3] flags=[R] seq=2058382919, ack=0, win=0 state=CLOSED rcv_nxt=2058382919, snd_una=204324094
2020-10-10 12:32:44.840567+0300 SportsU[458:23961] [] tcp_input [C3.1:3] flags=[R] seq=3890599702, ack=0, win=0 state=CLOSED rcv_nxt=3890599702, snd_una=657808210
2020-10-10 12:32:44.841061+0300 SportsU[458:23961] [] tcp_input [C4.1:3] flags=[R] seq=3519000591, ack=0, win=0 state=CLOSED rcv_nxt=3519000591, snd_una=2187263809
2020-10-10 12:32:44.851034+0300 SportsU[458:23961] [] tcp_input [C3.1:3] flags=[R] seq=3890599702, ack=0, win=0 state=CLOSED rcv_nxt=3890599702, snd_una=657808210
2020-10-10 12:32:44.853207+0300 SportsU[458:23961] [] tcp_input [C4.1:3] flags=[R] seq=3519000591, ack=0, win=0 state=CLOSED rcv_nxt=3519000591, snd_una=2187263809
2020-10-10 12:32:44.989014+0300 SportsU[458:24782] [branch.io] BNCNetworkService.m(205) Debug: Network finish operation https://cdn.branch.io/sdk/uriskiplist_v2.json 0.281s. Status 200 error (null).
{}.
2020-10-10 12:32:45.329664+0300 SportsU[458:24784] [] tcp_input [C7.1:3] flags=[R] seq=134971466, ack=0, win=0 state=CLOSED rcv_nxt=134971466, snd_una=2755241024
2020-10-10 12:32:45.332011+0300 SportsU[458:24784] [] tcp_input [C7.1:3] flags=[R] seq=134971466, ack=0, win=0 state=CLOSED rcv_nxt=134971466, snd_una=2755241024
(lldb) 
  override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        //MARK: register
        GeneratedPluginRegistrant.register(with: self)

        //MARK: register my notification plugin
        notificationPlugin.register(withRegistrar: self.registrar(forPlugin: "NotificationPlugIn"))
....

import Foundation
import Flutter
import streams_channel

class NotificationPlugin: NSObject {

    var handler:StreamHandlerSwift = StreamHandlerSwift()
    public func sendData(data:String){
        DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
            self.handler.send(data: data)
        }
    }

    func register(withRegistrar registrar: (NSObjectProtocol & FlutterPluginRegistrar)?) {

        let channel =  FlutterStreamsChannel(name: "my_message_handler_ch", binaryMessenger: registrar?.messenger() as! FlutterBinaryMessenger)

        channel.setStreamHandlerFactory( { (ar) in
            return self.handler
        })
    }

}

class StreamHandlerSwift: NSObject,FlutterStreamHandler {
    private var eventSink: FlutterEventSink?

    public func send(data:String){
        if let event = eventSink {
            event(data)
        }else{
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.4 * 60) {
                self.send(data: data)
            }
        }
    }

    func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
        if let arguments = arguments {
            print("StreamHandler - onListen: \(arguments)")
        }

        self.eventSink = events
        return nil
    }

    func onCancel(withArguments arguments: Any?) -> FlutterError? {
        if let arguments = arguments {
            print("StreamHandler - onCancel: \(arguments)")
        }

        return nil
    }
}

Where can be a problem?

followthemoney1 commented 4 years ago

The problem starts when i update plugin to 3.0.0 version

nathanschile commented 3 years ago

I'm also running into this issue.