Using HKSource.default() in an HKQuery predicate not working correctly in watchOS 7 - apple-watch

In watchOS 6, I was creating an HKQuery for the my app using:
HKQuery.predicateForObjects(from: HKSource.default())
which when executed, was successfully returning HealthKit data only for my app.
In watchOS 7 when I include this predicate in the query, I get no results upon executing the query. Where the exact same query (with the HKSource.default() predicate) does return results in watchOS 6.
Note: I do get the expected results in iOS 14, so I am only seeing unexpected results in watchOS.
Is this a watchOS 7 bug? Or has the behavior changed for HKSource in watchOS 7? I can't find any relevant documentation or bug reporting around HKSource that would explain this difference.

Related

AVCapturePhotoOutput - changes in Xcode 9 Beta 5

Just installed the latest XCode version which provided some changes in AVCapturePhotoOutput class, I wonder how to fetch the list of support flash modes. In the previous version, I used supportedFlashModes property which is no more available
open var __supportedFlashModes: [NSNumber] { get }
I guess new Swiftified supportedFlashModes property is planned but not yet completed in beta 5.
open var supportedFlashModes: [AVCaptureDevice.FlashMode] { get }
Until the day my guess will be confirmed (can be negative), you can use __supportedFlashModes. It's not removed, just renamed.
(Some betas contain this sort of under-construction renaming.)
You should better send a bug report to keep Apple aware of this issue.
EDIT
Seems iOS 11 SDK/Xcode 9.1 has fixed this issue and the Release Notes of Xcode 9.1 beta say:
The following AVFoundation API are now available:
AVCaptureDevice.Format.supportedColorSpaces
AVCaptureDevice.supportedFlashModes
AVCapturePhotoOutput.availablePhotoPixelFormatTypes
AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes
AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes
Code which was previously modified to use a double underscore as a
workaround should be modified to use these public symbols or the app
may be rejected by the App Store.
(Bold style added.)
Apple camera dev team confirms the Swift version of the API was inadvertently left out of Xcode 9 release.
Until fixed have to use __supportedFlashModes
See here: https://forums.developer.apple.com/thread/86810
BTW some other AVFoundation APIs also affected.

Firebase issue - no response from Realtime database on iPod with iOS 8.3

I'm developing an iOS app written in Swift 3.0 using Xcode 8.2, which supports iOS 8.0 and higher. App's data is stored in Firebase.
I want to listen to database connection changes (app is connected to Firebase or not).
I'm using FIRDatabaseReference's function:
func observe(_ eventType: FIRDataEventType, with block: #escaping (FIRDataSnapshot) -> Swift.Void, withCancel cancelBlock: ((Error) -> Swift.Void)? = nil) -> UInt
to observe changes, but this event always returns false (value of 0). At this time (on Firebase Console), Authentication section related queries are working properly, and Realtime Database related queries are not.
This happens only on iPod 5.1 (5) with iOS 8.3.
I've tested my application on
iPad 2 with iOS 8.4.1
iPod 5.1 (5) with iOS 9.3.5
iPhone 6 with iOS 10.0.1
too. But on these devices it worked well.
Am I doing something wrong? Is there any issue related to iOS version and Firebase SDK?
Thank you!
SOLVED
I left this issue a little bit behind, and after some time, it reappeared on another device.
I'm not sure, if this solves every similar problem, but I figured out, that my token was expired and I get NO response from database. Which problem was caused by a password change of the same user on another device.
Day 1 - I was logged in with an account on two different devices. I changed my password on one of them.
Day 2 - I tried to download some data from Realtime Database section with the other device, but I get NO response, which was really annoying.
After 8 hours Firebase Analytics logs on Xcode console finally helped me figure out the problem. I logged out from the problematic device, and then logged in again.
I was wondering why couldn't I get some kind of 'token_expired'-response from the server, or maybe why couldn't I get logged out from the other devices.

Swift po causes error 'Failed to load linked library Metal'

How can I print out a Swift variable's value in XCode 6 GM with LLDB? It seems to be broken since early betas. But at the same time po works perfectly fine in Objective-C code
I've previously tried all XCode 6 betas and got the same result. Even when I start a new project from scratch it's all the same. For example, I put a breakpoint in func application(application, didFinishLaunchingWithOptions)
(lldb) po application
error: Error in auto-import:
Failed to load linked library Metal of module sandbox - errors:
Looking for "#rpath/Metal.framework/Metal", error: not a string object
I've never imported or linked against Metal.framework in any of my projects. Does there exist any way to solve this?
Don't know the reason that po is broken in xCode 6, but I am able to print an object by
Right clicking an object in the Debug Area
and clicking -> Print Description of "OBJECT_NAME"
Hope this will help someone else, until the xCode bug is fixed
The bug was fixed in XCode 6.1
Resolved Issues - Debugging
Swift expressions like 'expr', 'p', and 'print' that are evaluated
from the LLDB prompt in the debugger console will now work on 32-bit
iOS devices. (18249931)
https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html
Metal.framework is a new framework provided by Apple in iOS8. Seems like AVFoundation has references to it. I think you getting this error running your app on iOS7 device or simulator. Try to check on iOS8.

SQL error on iOS5 but not iOS4

I am using sqlite in an app for iOS, and it was working perfectly fine to retrieve objects from the data base on iOS4. But on iOS5, when I execute a statement (using the function sqlite3_step), it sometimes returns a SQLITE_CORRUPT error (meaning that "The database disk image is malformed").
The request fails upon this error. When using a third party app to inspect this database I also stumble on this error.
My question is: why has changed between iOS4 and 5 to stop the request to work just fine? Is there a way to configure sqlite on iOS to ignore this kind of error?
I precise that I'm using the very same code and database on the 2 version of the OS....

Why do my OCMock expects and stubs fail in iOS 5?

I have some simple mock objects with some stubs and expectations set up. When I run my tests on the iOS 4.3 simulator, everything passes. When I run on iOS 5, I get "unexpected method invoked" failures. As an example case, I have a method - (void) foo: (NSString *) bar that I set up an expectation for and then run. The result is
unexpected method invoked: foo:#"foobar"
expected: foo:#"foobar"
Any one know why this is happening, or how to fix it? The tests themselves are perfectly fine, and have been working for months in iOS 4.
Sorry only saw this now. It has been fixed for a while
https://github.com/erikdoe/ocmock/commit/db6f27041efc507ae6ab92721e2f7bbbbd14c28b
Update: The newly released version 2.0 of OCMock contains this fix. So, you don't have to build from source if you don't want to.
I'm using the latest version of OCMock from Github on iOS 5 without any problems. There have been some recent additions to this repository, so it's quite possible that the problems you're experiencing have been fixed in the latest version.