HomeKit Delegate APIs not working inside iOS flutter plugin - ios

I am developing a flutter plugin for accessing Apple HomeKit features inside my flutter app. The following project and code setup is done for iOS project inside flutter folder:
Project setup:
1. Enabled HomeKit in Capabilities
2. Added Privacy – HomeKit Usage Description Key in Info.plist
Code Setup inside plugin:
1. Created instance of HMHomeManager
2. Set the HMHomeManager delegate
3. Implemented delegate methods
Also, cross verified the access to HomeKit for my flutter app in the Settings.
Issue 1:
For the same set up, a native iOS application is running fine and homeManagerDidUpdateHomes delegate method is getting called immediately after accessing HomeKit Database which is properly providing Home information.
But, in flutter plugin, delegate method is not getting called and always home count is Zero.
Issue2:
I have written code to add new HomeKit Home inside iOS plugin and tried calling the method from flutter UI. Strangely the code inside addHome(withName: ) block is not executing but Home is getting created inside HomeKit database. This is confirmed by running Apple ‘Home’ app.
In this case also, homeManager(didAdd home: ) delegate method is not called.
Version details:
Xcode: 11.2, swift 4.2
Flutter: 1.14.6, Dart: 2.8.0
Does any other set up is required in flutter plugin to set HomeKit Delegate?
As an alternative approach, also tried using cupertino_ffi_generated 0.1.1 (https://pub.dev/packages/cupertino_ffi_generated) which is a recent package from flutter for accessing Apple APIs. (Even though it is directly mentioned: “Most Flutter developers should not use this package. It's almost always a better idea to write a Flutter plugin than use this package.” ).
But, flutter throwing an error ‘Target of URI doesn't exist:’
Version details:
Flutter: 1.14.6, Dart: 2.8.0

I was facing a similar problem. iOS swift delegate methods were not triggered. It appears that the methods must have been declared public.
Just replace
func addHome...
with
public func addHome...
Maybe it will helps someone...

Related

IllegalAccessError on Android Things

My app is throwing an IllegalAccessError after updating to the latest Android Things
preview. I have the following code to check for an OTA update:
UpdateManager manager = new UpdateManager();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
When I run this code I get the following error output:
java.lang.IllegalAccessError: Method 'void com.google.android.things.update.UpdateManager.<init>()' is inaccessible to class 'com.example.android.things.screensettings.MainActivity' (...)
This code was working before, why has this started happening after the update?
Starting in Preview 7, Android Things API services are not constructed as new
instances. They are instead accessed as singletons via getInstance() to be
more in line with Android API paradigms.
Be sure to update your app to use the Preview 7 SDK:
dependencies {
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
}
Then modify your code to use getInstance() instead:
UpdateManager manager = UpdateManager.getInstance();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
Review the Android Things API reference
to verify if any of the other APIs you are calling have changed.

"[Crashlytics:Crash] Reporting is disabled"

I am getting the following error messages when our production iOS app initializes:
[Crashlytics] Version 3.8.4 (121)
[Crashlytics] Running on iOS Simulator (iPhone), 10.3.0 (16E195)
[Crashlytics:Crash] Reporting is disabled
[Crashlytics] Crash reporting could not be initialized
[Answers] Initialized
[Fabric] Initialized with kit versions: {
"com.twitter.answers.ios" = "1.3.4";
"com.twitter.crashlytics.ios" = "3.8.4";
"io.fabric.sdk.ios" = "1.6.11";
}
Every subsequent call to log an event gets the following error:
[Crashlytics:Crash] WARNING: CLSLog has been used before (or concurrently with)
Crashlytics initialization and cannot be recorded. The message was: ...
The non-production versions of the app work fine running the exact same code but with different bundleIDs. Normally when the app initializes for the first time, then I see the app populate in the Fabric dashboard, but in this case the app is not showing up.
We have an Android and an iOS version of the app, and they both use the same bundleID, so I am wondering if there is a conflict because of that? I see the Android version of the app in the dashboard, and it seems to be working properly. This is an app that originally was a Xamarin app that compiled to both platforms, neither of which incorporated Fabric/Crashlytics. We have now written native apps on each platform, and both are using Fabric/Crashlytics.
Since this is a pre-existing app in both stores, we do not have the option of changing either app’s bundleID.
Make sure you initialize Crashlytics with Fabric before calling any Crashlytics methods:
Fabric.with([Crashlytics.self])
One step I routinely miss is to make sure you've added the build phase on your target:
"${PODS_ROOT}/Fabric/run" ${FABRIC_API_KEY} ${FABRIC_BUILD_SECRET}
and either replace ${FABRIC_API_KEY} and ${FABRIC_BUILD_SECRET} with your key and secret or add custom build settings for each.
There are apparently cases where Crashlytics does not auto-activate new apps so that they show up under your list of apps, even though everything is coded correctly and data is going to their servers. In this case, send an email to Crashlytics support (support#fabric.io) that contains a copy of the info.plist entries for the app in question and they will activate it for you. I have had to do this several times, especially with app extensions.
When I finally traced it down in my situation, the error was entirely correct, but not obvious.
I saw these errors in various testing targets where the code we tested was using a custom logging wrapper which called CLSNSLogv(), but the test didn't actually go through the AppDelegate and therefore did NOT initialize Crashlytics. After trying a few things I was convinced that it worked when executed as an app, but in our configuration it was not working under the unit test configuration.
I'll likely alter our custom wrapper to bypass CLSNSLogv() during testing anyway. The biggest benefit of using that is when crashes occur on devices, so we won't be missing anything.

QuickBlox iOS SDK , Enabling Cloud Back-End Server AUTHKEY/APPLICATION ID TO APP DELEGATE

I have followed all the guidelines of how to set up the iOS SDK that QuickBlox provides. I added the SDK through cocoa pods, added the run script with the snippet code. example here! I came to a crossroad and got stuck in how to add the auth-key, app-id.. ect. To The app delegate?
This is how you set the values in AppDelegate for QuickBlox
First
import Quickblox
in your AppDelegate, then in didFinishLaunching add this
QBSettings.setApplicationID(yourAppId)
QBSettings.setAuthKey(yourAuthKey)
QBSettings.setAuthSecret(yourAuthSecret)
QBSettings.setAccountKey(yourAccountKey)

$ngCordova BLE plugin is undefined on iOS

I am working on connecting my iOS 5c v9.3.2 to my arduino uno with the blefruit add on. I am working on an Ionic project with the most recent version of ionic and cordova installed. I tried installed ngCordova, and included the cordova-plugin-ble-central to my plugins. I injected $cordovaBLE as I saw a few other examples show, but it was just an empty object when I ran the following code within the controller: alert(JSON.stirngify($cordovaBLE)); I also tried that with ble but it did not show a message. I believe that ble is undefined and because of that, the $cordovaBLE could not properly create it's functions. Is anyone else having this issue or might be able to help?
I tried creating a new project in ionic and setting it up as I had above, and this time when I used the ble to call my functions and copied the code directly from it's readme.md, it worked. I was passing an object where I should have been passing a success callback.

Reminder API in iOS 6.0

Strange bug in iOS 6.0 sdk. Apple promised to deliver full reminder support via api, to allow thirdparty applications to read and write reminders on behalf of user. There is new methods in SDK to init storekit for use with reminders.
But seems like main method to make it possible - just not present. Both GM version of XCode 4.5 and simulator/ios-6 upgraded device shows that EKEventStore:initWithAccessToEntityTypes is not present in SDK and attempt to call it on device/simulator crashing application with
Error invoking method 'EKRemsIsGranted' on 'CEKtils' because
-[EKEventStore initWithAccessToEntityTypes:]: unrecognized selector sent to instance 0x13a59140
Interesting that this method is also mentioned and described in MacOs 10.8
but in iOS sdk it is mentioned but NOT described
Seems like apple devs forgot to "enable" it on iOS. is it possible at all or I missing something?
There's a description of the event (and some other useful information) here. You might also double-check that your UIEventKit framework is properly linked and up to date.

Resources