Strange HealthKit Access issue - ios

I'm working on retrieving steps data within HealthKit. The query all works as expected (I'm only retrieving step data) however I'm having a strange issue with the Health Access modal that appears (see screenshot below - this is NOT my app, just an example screenshot taken from the web)
The issue is when the user soft closes the app (i.e. pressing the home to get to springboard) and then goes back into the app. The modal doesn't want to disappear when clicking allow or disallow.
Looking at the log it appears I have this strange error:
Error Domain=com.apple.healthkit Code=5 "(null)"
Any thoughts? If further info is required please let me know.
P.S. Just an addition to this, I notice that when clicking "Don't Allow" (where the "Cancel" is within the screenshot), I get an alert dialogue stating:
"You can turn on health data categories later in the Health app."
Upon clicking "OK" the Health Access screen still does not dismiss.
P.S.S. Not sure if this affect this but when the Health Access screen appears, it does so with the following message in the Log:
Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x1343f4040>.

Related

WCSession connection fails at specific moment

I have a weird behavior happening to me while using the watch connectivity.
I start the session from the AppDelegate's didFinishLaunchingWithOptions.
The user's goes through the login process, and when the user get's to the home screen if the user open's the Watch it seems that something goes wrong with the session.
At this point I get this log:
[WC] -[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke delegate MCEWatchSessionDelegate does not implement delegate method
[WC] -[WCSession _onqueue_sendResponseError:identifier:dictionaryMessage:] identifier: [identifier] with WCErrorCodeDeliveryFailed
And at this moment if I print the error on the watch if get:
Error Domain=WCErrorDomain Code=7014 "Payload could not be delivered." UserInfo={NSLocalizedDescription=Payload could not be delivered.}
and there is nothing in the login process using the session or anything related to the WatchConnectivity.
If the user opens the watch app on the login screen, everything works as expected.
If I close and open the app again (session get's activated again) it runs normally and the issue is gone.
If I activate the session again from the iPhone app after the watch has tried and failed to send the message, it goes back to normal.
If I dispatch a queue with a delay, activating the session again on the Iphone app to after the home screen is shown, it also work's normally.
The problem seems to happen only on the first time the user enters the application after the installation, manually log's in and get's to the home screen.

MobileFirst Platform Operational Analytics - Log Screen Visit Times and Custom Crash Details

I'm developing an iOS app using MFP 7.0.
Each screen (i.e., view controller) has a unique ID, and I am supposed to use Operational Analytics to send the following info to the server:
How long the user spent on each screen
On which screen the app crashed
Regarding #1, I guess I am supposed to use WLAnalytics's
- (void) log:(NSString*)message withMetadata:(NSDictionary*)metadata;
(right?)
How can I manage #2? Should I just log the screen ID (using the method above) every time a transition occurs, and expect the last logged id to be passed when the crash log is sent? Or is there any other way to add custom information to crash logs?
Correct you can follow Custom Data, Custom Charts here https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/moving-production/operational-analytics/
Crash log is detected and sent automatically post crash next time app is started. There is no way to add custom data to that report. Usually the place where the error happen could be deduced form the crash data stack, if this is not sufficient, you can apply the technique you are describing.

UIActivityViewController: prevent activity from appearing if an error occurs after the user selects the activity?

In my app, I have a UIActivityViewController containing standard items like UIMailActivity (and Messages, Facebook, etc). Sometimes, the user will tap one of these activities, but an error will occur that prevents sharing of the item. What ends up happening is an error message will be displayed, but Mail (or Messages etc) will open up anyway with no content.
Is there a way to either:
Prevent the activity from running if an error occurs
Immediately dismiss the activity if an error occurs

GameKit Error says player not authenticated but .authenticated property = true

I have an turn-based game using GameKit in iOS. Generally, my authentication with Game Center works. My game works and I can for periods of time send moves back and forth. However, relatively frequently but not constantly, when I try to perform an action (e.g., finding a new match) over Game Center it fails with the error:
Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo={NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}
Yet, the GKLocalPlayer.localPlayer().authenticated = true, both immediately before getting the error and after. After getting this error, the authentication viewController does not get presented and GameKit methods that rely on authentication cease to function (they don't come back to life ). Then, if I send the app to the background and then bring it back to the foreground, the error does not return when I retry the action (without requiring new login and password entry).
According to this similar observation:
GKLocalPlayer authentication not working, but isAuthenticated returns YES (Game Center sandbox)
"1.Game Center fails to complete authentication if your device has incorrect dates. So, go ahead and check the current date.
You might have done this. I trust you - iOS Simulator >> Reset Content and Settings"
I am getting this problem on the device, not the simulator, ruling out #2. Could someone help me with #1? I may be naive here, but my iPhone and iPad have the right time and date. Is there something or somewhere else I should be checking and setting?
Then, if this is not the issue, what else could be the problem? I am running iOS9.
I've seen this too, and have an open bug with Apple. In my case, I'm testing with multiple physical devices, and only one of those devices ever encounters this. On that particular device, I'm logged into iTunes using a personal account, but logged into game center using a test account.
From what I can see, when the device is using the same login for iTunes, iCloud and game Center, there are no problems. But, when I try to mix-and-match the accounts for whatever testing I need to do, then I randomly get error 6.
There doesn't seem to be anyway to recover from this, except to have the user re-login into game center. Of course, there's no way to present the login view controller again, so the only option is for the user to leave the game, kill it off, and star up again (which re-starts the game center authentication process). I trap the error now, give the user a message saying Game Center has logged them out, and explain what they need to do about it.
But as I said, when I stopped mixing up credentials on the device, the problem went away.
BTW, on a slightly related topic, I've come to view the .authenticated property as completely unreliable. It will be TRUE in conditions where you do not actually have connection to Game Center. I opened a bug on this, too. Apple closed it saying this was working as intended by using "cached" data. Thus, it will report authenticated when it's not authenticated and give you access only to outdated match and leaderboard data which had previously been saved locally.

keep on getting error in gamecenter authantication with ios8.1

Suddenly in my project,I keep on getting error as below which works well before.
error:
{
NSLocalizedDescription = "The requested operation has been canceled or disabled by the user.";
}, 2
I can see the GameCenter login window several days ago,but now it doesn't show again.
After search with error info above in statckoverflow ,I found this has happened with ios7。3 times after dismiss of GameCenter login window,it never shows again.I reset the hardware,then it works。
It seems the same problem in ios8.1 with in ios7.Will it be solved in later version all it is the strategy that never changed,means it does not fixed in ios7.1 ?
I suppose that if you switch to the Game Center app and log in there all will be good. After a third unsuccessful login attempt in GKGameCenterViewController (i.e. your app) that is normally required.

Resources