I need to notify WidgetKit to reload my iOS 14 widget. In Swift you can do that using WidgetCenter:
WidgetCenter.shared.reloadAllTimelines()
However, WidgetKit seems to be unavailable in Xamarin.iOS.
WidgetKit's reloadAllTimelines is not currently available to Xamarin.iOS (it is available only via the Swift-based frameworks and technically Xamarin.iOS binds the ObjC frameworks).
It is on the Xamarin.iOS enhancement list
[Xcode 12] WidgetKit reloadTimelines API is Swift only but really needs to be callable from C# host app #9215
Currently you would need to write a Swift library and then Xamarin.iOS bind it to expose it so you can call it from .Net code.
Bind iOS Swift libraries
[xcode12] WidgetKit #8933
Third-party repo/project that exposes WidgetKit's ReloadTimeLinesOfKind, ReloadAllTimeLines, & GetCurrentConfigurationsWithCompletion (see Wojciech Kulik's comment below)
Related
In android, to send a string from the App to unity is quite simple:
mUnity = new UnityPlayer(this,this);
mUnityPlayer.UnitySendMessage("UnityReceiveData", "receivePlayer1Username", value);
With UnityReceiveData the gameObject, receivePlayer1Username the method name and value.
I saw that a similar method exists from Ios but it apparently can not be called directly on unity 2019 and later.
Based on this structure is a proxy needed? How to call unitysendMessage from Ios App main code?
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...
Actually, I have created a custom framework. I am using Google Analytics in the main project and in the custom framework (That I have created) as well. When I am trying to get GAI(Google AnalyticsInstance) object in my custom framework the app is crashing. Although It is working fine with iOS 11 but crashed on iOS 10.
Exact line where I am getting crash: GAI.sharedInstance().
Please help. Thanks in advance.
I was using this function to change the font size of a label in UIButton.
Like this(SWIFT) :-
Button!.titleLabel?.font = Button!.titleLabel?.font.fontWithSize(12)
I want to see the availability of this funtion for ios 7. So i see the quick help documentation of Xcode. There it was mentioned as iOS (8.0 and later)
Then i went on to search for the appropiate funtion on apple website but there it is wriiten that its available from Available in iOS 2.0 and later. See Here for ref.
Please do let me know which one to trust.
I saw answer but i am not that satisfied as i check the other class
Like NSMutableAttributedString for swift
here it is written as available from iOS (3.2 and later)
My strong guess is that since Swift came out together with iOS 8 Apple's documentation won't show anything being available before that. If you check the same method on Objective-C side, you'll see the same as on the web:
I also have a project targeting iOS 7 with calls to fontWithSize in Objective C and they work fine. So there should be no reason for it to not be available on Swift side of things.
Also found information from Apple's Radar system:
Engineering has the following feedback for you:
This is expected - Swift was not available until WWDC 2014 and the introduction of iOS 8, therefore the availability of these methods and contstants in Swift is correctly documented as iOS 8+.
Thank you for your feedback. Engineering has determined that this issue behaves as intended.
So clearly this is the Apple way of doing things, as usual.
in Objective C
it is still 2.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.