Flutter [iOS] - Create plugin which uses plugins - ios

I've created a plugin to use in one of our Flutter apps.
This plugin uses another two plugins: keyboard visibility and url launcher.
When I execute the example app within the plugin project everything works fine but, when I import our plugin project in our app, then this transitive dependencies fail when registering native code:
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache, aborting restore
flutter: ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
flutter: The following MissingPluginException was thrown while activating platform stream on channel
flutter: github.com/adee42/flutter_keyboard_visibility:
flutter: MissingPluginException(No implementation found for method listen on channel
flutter: github.com/adee42/flutter_keyboard_visibility)
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
flutter:
flutter: #1 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:490:29)
flutter:
flutter: #6 new KeyboardVisibilityNotification (package:keyboard_visibility/keyboard_visibility.dart:40:92)
This happened in both Android & iOS platforms. I fixed the Android part by adding the native code register, but in iOS it's still failing:
import UIKit
import Flutter
import os
#UIApplicationMain
#objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
[...]
Any help? Thanks.

Related

flutter firebase integration leveled/db file not found error

Am trying to build an iOS app with firebase database!
its a flutter app.
When I try to build the app for iOS device or simulator, am getting below error
/Users/dsp/Development/mia_flutter/ios/Pods/FirebaseDatabase/Firebase/Database/third_party/Wrap-leveldb/APLevelDB.mm:54:9: fatal error: 'leveldb/db.h' file not found
import "leveldb/db.h"
if I change the leveldb to leveled-library its working fine. Its working fine in android:
Below is My pub spec.yaml:
dependencies:
flutter:
sdk: flutter
firebase_admob: ^0.5.4+1
flutter_facebook_login: "^1.1.1"
cloud_firestore: ^0.7.3
firebase_auth: "^0.5.11"

XCode 9 failed to build : Dyld error message Image not found

On XCode 9, I'm not able to build my project, with this error :
KVNProgress Group/Users/xxx/Documents/project/Pods/KVNProgress/KVNProgress/Resources/KVNProgressView.xib
/Users/xxx/development/project/Pods/KVNProgress/KVNProgress/Resources/KVNProgressView.xib: Internal error. Please file a bug at bugreport.apple.com and attach "/var/folders/kb/3qmqmk_569v9ggc23nnc5btm0000gn/T/IB-agent-diagnostics_2018-02-16_10-30-34_345000".
Crash detail :
Process: Interface Builder Cocoa Touch Tool [10066]
Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/Interface Builder Cocoa Touch Tool
Identifier: Interface Builder Cocoa Touch Tool
Version: 9.2 (13772)
Code Type: X86-64 (Native)
Parent Process: ibtoold [10050]
Responsible: Interface Builder Cocoa Touch Tool [10066]
User ID: 262
Date/Time: 2018-02-15 14:33:28.445 +0100
OS Version: Mac OS X 10.12.6 (16G1114)
Report Version: 12
Anonymous UUID: C68970F4-1365-1C3A-554B-396EA6A954FC
Time Awake Since Boot: 1800 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks
Library not loaded: /System/Library/PrivateFrameworks/CoreAnalytics.framework/CoreAnalytics
Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/WirelessDiagnostics.framework/WirelessDiagnostics
Reason: image not found
I tried a lot of solutions from Reason: no suitable image found. but I still have the problem.
Important precision : On my other mac, the project build correctly.
Before yesterday, project build on this mac...
I tried to delete and recreate all the Provisioning profile and Certificates, to delete XCode cash, remove project and recreate from git and install pod again, restart mac, clean derived data, but nothing works...
Other precision : I'm not able to build another project with KVNProgress lib.
Turns out Avast quarantined the file that was missing.
Restored the file and Xcode worked fine

Firebase - <FIRInstanceID/WARNING> xcode 8.2.1 - iOS 10.2

I am getting the following warning in the console
< FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
What does this warning mean in layman terms?
Details:
iOS 10.2
xcode 8.2.1
Running on my device
FirebaseInstanceID (1.0.8)
Firebase 3.11.0

Can't find variable: FileTransfer on IOS

I'm using the cordova's FileTransfer plugin with the ionic-native wrapper. The app runs successfully in iPhone simulator but when I run the app in my mobile device I get the error in the console as:
ORIGINAL EXCEPTION: ReferenceError: Can't find variable: FileTransfer with some stack trace.
Findings:
The app runs without any issue on Android devices
Reseting ionic state has no effect
Entering FileTransfer in console returns its object. So, it is clear that it has been initialized
The app runs good when all the reference to that plugin are removed from the app, even though there are other plugins(camera & datepicker). So, only the file-transfer plugin creates the problem.
Roughly 1 out of 10 times the app run in the device without any error but it crashes after restarting the app.
Plugins used
cordova-plugin-camera
cordova-plugin-datepicker
cordova-plugin-file-transfer
cordova-plugin-whitelist
Specifications:
Simulator iPhone6/iOS 9.3
Devices iPhone6/iOS 9.3.1 & iPhone4S/iOS 9.3.5
Cordova CLI: 6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.4.5
Xcode version: Xcode 7.3.1 Build version 7D1014
Code:
import {Injectable} from '#angular/core';
import {Transfer} from 'ionic-native';
#Injectable()
export class MyClass {
fileTransfer = new Transfer();
constructor(){
}
public upload (url: string, image: string, onProgress: any, opt?: any){
let options = {
fileKey: "file",
mimeType: "image/png",
chunkedMode: false
}
this.fileTransfer.onProgress(onProgress);
return this.fileTransfer.upload(image, this.baseUrl + url, options);
}
}
Uninstalling all the plugins and just running ionic run ios command fixed this issue. Since the ionic state reset also does the same thing, this might be a problem with the CLI.

Crashlytics installing - stuck on verifying installation step 2 of 2

I want to add Crashlytics to my project and I made everything according to Fabric Mac app and I now stuck at
Step 2 of 2 when verifying installation
I've added:
[Fabric with:#[[Crashlytics class]]];
to method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
and I added imports too:
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
App is launched but in Fabric app there is still progress and nothing.
When I set debugMode to Yes I get these infos:
2016-07-13 11:23:21.689 Archimedes Cool[8565:3143059] [Crashlytics]
Version 3.7.2 (112) 2016-07-13 11:23:21.789 Archimedes
Cool[8565:3143059] [Crashlytics] Running on iPad4,4, 9.3.2 (13F69)
2016-07-13 11:23:21.883 Archimedes Cool[8565:3143059] [Fabric]
Initialized with kit versions: { "com.twitter.answers.ios" = "1.2.1";
"com.twitter.crashlytics.ios" = "3.7.2"; "io.fabric.sdk.ios" =
"1.6.7"; }
2016-07-13 11:23:22.555 Archimedes Cool[8565:3143092] [Fabric] failed
to download settings Error Domain=NSPOSIXErrorDomain Code=2 "No such
file or directory"
UserInfo={NSErrorFailingURLKey=https://settings.crashlytics.com/spi/v2/platforms/ios/apps/cz.ai.Archimedes-Cool/settings?build_version=1.24.3.4537&display_version=1.24.3&instance=a5697790406418f18d7057545ad7cf5cc23e431d&icon_hash=db9967486042bc2829965401b58f06c932384acd&source=1,
NSErrorFailingURLStringKey=https://settings.crashlytics.com/spi/v2/platforms/ios/apps/cz.ai.Archimedes-Cool/settings?build_version=1.24.3.4537&display_version=1.24.3&instance=a5697790406418f18d7057545ad7cf5cc23e431d&icon_hash=db9967486042bc2829965401b58f06c932384acd&source=1}
I've tried it with real devices (iPad and iPhone) but not in simulator. I even tried to install it via CocoaPods but same problem. Can anyone help me? Thanks
From this answer:
this appears to happen when there is a method being called after the
Fabric init that is removing the temp directory of the app.This can
result in a race condition where new data is being written for other
Answers events, but new sessions are not recorded properly.
Move the Fabric initialization in the end of the didFinishLaunchingWithOptions in order to avoid other methods to override or delete the app's temp directory

Resources