LocationListener.onLocationChanged not called for Oreo Device - google-play-services

Callback method LocationListener.onLocationChanged() not called in the Oreo devices and on devices below Oreo it's working fine.
Is this coming due to using of deprecated class LocationServices.FusedLocationApi?

Related

WatchConnectivity on Xcode 14

I made a "todo" app, using core data, and want to extend it to apple watch. The main problem is that when I run the simulator, the watch seems to be not connected with iPhone.
I tried to import WatchConnectivity, use WCSession, delegate, and they are all not working because the watch is not getting connected with the phone in the first place.
I am using SwiftUI, but not storyboard

Camera (AVFoundation new APIs) classes for iOS 10 does not found

I am facing the error: No known method for selector
defaultDeviceWithDeviceType:mediaType:position:
While documentation for this method is given at:
AVCap
When I call this method, it shows error that method not found. My code is:
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithDeviceType: AVCaptureDeviceTypeBuiltInDuoCamera
mediaType: AVMediaTypeVideo
position: AVCaptureDevicePositionBack];
Here are all the version details:
MacOS: 10.11.5,
xCode: 8.0 beta,
iOS: 10.0.1
The AVCaptureDevice methods devices and devicesWithMediaType: are deprecated in iOS 10, and do not provide access to the dual camera or telephoto camera.
When you use the AVCaptureDevice class for video or photo capture, you
can choose to use the dual camera device to gain these features, or to
specifically use only the wide-angle or telephoto camera for more
manual control.
To access capture devices in iOS 10.0 and later, you can use either of the following methods:
Call the defaultDeviceWithDeviceType:mediaType:position: method. (Pass the AVCaptureDeviceTypeBuiltInDuoCamera device type to access the dual camera.
That call returns nil for devices without a dual camera—in that case, you can call the same method again, passing the AVCaptureDeviceTypeBuiltInWideAngleCamera device type, to obtain the default back camera.)
Create an AVCaptureDeviceDiscoverySession object, passing the device attributes you want to use for capture, and enumerate its devices list to select a device for your capture session.
read docs here:
https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS10.html#//apple_ref/doc/uid/TP40017084-DontLinkElementID_11
When I switched from xCode 8.0 beta to release version xCode 8.0 then it worked.Thanks

iOS how can I use storyboard elements that don't exist in earlier versions of iOS?

I have a project originally targeting iOS7 using a storyboard. I've added a UIStackView to a view controller and get an error that "UIStackView before iOS 9.0". The build fails because of this error.
How can I keep my project as iOS7, while conditionally including newer storyboard elements from iOS9 if device supports them?
I already have conditional code in the project that only runs on iOS8+, but how can I do something similar with a storyboard?
The class UIStackView (and its software) is provided by iOS 9, but is not provided by iOS 8 or 7. When the app tries to instantiate an object from the storyboard in iOS 8, it will fail because it cannot find the class.
The only ways around this:
have different storyboards for different iOS vesions
build a custom class that does the same thing. Then you can use it in the older versions of the iOS. You might find open source libraries that already do this for the class you want.

How to simulate the Local Notification in apple Watch App?

I am trying to simulate the local notification view in apple watch simulator. Does any one known how to simulate the local notifications in apple watch ?
I have done some research for that but didn't found any answer for the above. There is a way to simulate the PUSH NOTIFICATION but not for the LOCAL NOTIFICATION.
It is not possible to have a Watch app react to a UILocalNotification in the simulator. However, it is almost identical to reacting to a push notification, except it gets routed through a couple of different methods.
If you're presenting an actionable notification, your WKUserNotificationInterfaceController subclass would override -didReceiveLocalNotification:withCompletion: instead of -didReceiveRemoteNotification:withCompletion:.
If your Watch app is getting launched in response to interacting with one of your actionable notifications, then your root WKInterfaceController would implement -handleActionWithIdentifier:forLocalNotification: or -handleActionWithIdentifier:forRemoteNotification:, as appropriate.
From WatchKit's point-of-view, those are the only distinctions between remote and local notifications.
Run your watch app (notification target) on simulator, dismiss the notification and stay on clock face.
Switch to iOS simulator and create a notification. For testing purposes setup fireDate to something reasonable like:
notification.fireDate = NSDate().dateByAddingTimeInterval(10)
Here goes the trick. Hit ⌘L to lock iOS simulator.
Enjoy notification arriving to watch app.

EAAcessory errors while closing session with iOS 6.0 GM

There is a MFI device that is connected to iPhone 4S (6.0 GM) or to iPad (6.0 GM) via Bluetooth (2.1 + EDR). The project was built on Xcode 4.5 GM. When the app gets EAAccessoryDidDisconnectNotification it will send message [_eaSessionController closeSession];. All these worked nice in iOS 5.1.1 or earler. But on iOS6 with this message I got logs as follows:
-[NSCondition dealloc]: condition (<NSCondition: 0x2e5640> '(null)') deallocated while still in use
Break on _NSLockError() to debug.
Any ideas?
I came across the same issue. This warning is thrown when calling [NSStream close] upon receiving an EAAccessoryDidDisconnectNotification. There should be also some data exchange between the two devices just before the disconnection.
Breaking on _NSLockError will show that at the moment the object is deallocated, some of the threads spawned by the external accessory framework are waiting on conditions. One of those certainly waits on the condition that is being freed, which explains the warning thrown on the console.
I also noticed that the number of threads created by the external accessory framework keeps on growing each time the accessory disconnects then connects, and they seem to be just leaking.
It seems to me that somehow, the external accessory framework does not properly free the resources it allocates, which results in a lot of mess. One of the subsequent effects of this are crashes that happen inside one of those leaked threads during a call to OSAtomicCompareAndSwap64.
I managed to reproduce the issue using a basic sample in which the streams are scheduled on the main thread to avoid any thread management inside the application. I believe it's an accessory management bug on iOS 6 that Apple should be aware of. I'll report it and wait for what they have to say.
Meanwhile, I wonder if anyone of you guys has managed to make any progress on this.
Thanks,
There is no such trouble in iOS 6.1+. To fix this for iOS 6.0 and iOS 6.0.1 please use next solution:
Please note: this is only temp solution allow your users with iOS 6.0 and 6.0.1 continue use your app.
There is a simple hack to avoid application crashes: just create new category and override dealloc method (NSCondition) for iOS 6.0 and iOS 6.0.1:
#import "NSCondition+LeakDealloc.h"
#import <objc/runtime.h>
#implementation NSCondition (LeakDealloc)
- (void) safeDealloc
{
float sVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (sVersion < 6.0 || sVersion >= 6.1)
{
[self safeDealloc];
}
}
+ (void) load
{
method_exchangeImplementations(class_getInstanceMethod(self, #selector(dealloc)), class_getInstanceMethod(self, #selector(safeDealloc)));
}
#end
This solution make new leak, after 20 min tests and about 50 BG/FG swithces instruments shows 10 NSCondition leaks (960 Bytes), BUT no one crash!
The issue has been fixed in iOS 6.1.
There are no more leaking NSCondition or external accessory threads. Apple seem to having fixed the issue properly.