Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Bug with MotionPermission #170

Open
ogezue opened this issue May 12, 2016 · 1 comment
Open

Bug with MotionPermission #170

ogezue opened this issue May 12, 2016 · 1 comment
Labels

Comments

@ogezue
Copy link

ogezue commented May 12, 2016

I'm trying to use PermissionScope with Objective C and configure it to request for Motion, Location and Notification. I get a non deteministic behavior.

Sometimes PermissionScope is displayed after I open the UI a second time. Sometimes I'm in an endless loop of private func triggerMotionStatusUpdate() {} that gets called in self.permissionScope = [[PermissionScope alloc] init];. This results in a white screen and the iOS permission alert is visible when quitting the app.

Is the code below not correct or is this a bug in PermissionScope?

- (void)showPermissions{
   self.permissionScope = nil;
   self.permissionScope = [[PermissionScope alloc] init];
   self.permissionScope.headerLabel.text = NSLocalizedString(@"permission_header",nil);
   self.permissionScope.bodyLabel.text = NSLocalizedString(@"permission_body",nil);
   [self.permissionScope.closeButton setTitle:NSLocalizedString(@"Close",nil) forState:UIControlStateNormal];

   // Set up permissions
   [self.permissionScope addPermission:[[LocationWhileInUsePermission alloc] init] message:NSLocalizedString(@"LocationWhileInUsePermissionMessage",nil)];
       [self.permissionScope addPermission:[[MotionPermission alloc] init] message:NSLocalizedString(@"MotionPermissionMessage",nil)];
       [self.permissionScope addPermission:[[NotificationsPermission alloc] initWithNotificationCategories:nil] message:NSLocalizedString(@"NotificationsPermissionMessage",nil)];

   // Styles
   [self.permissionScope setLabelFont:[Styling fontDescription]];
   [self.permissionScope setButtonFont:[Styling fontDescription]];
   [self.permissionScope.headerLabel setFont:[Styling fontValue]];
   [self.permissionScope.bodyLabel setFont:[Styling fontDescription]];
   [self.permissionScope.closeButton setFrame:CGRectMake(0, 0, 100, 20)];
   [self.permissionScope setCloseOffset:CGSizeMake(-20, 0)];

   [self.permissionScope show:^(BOOL finished, NSArray<PermissionResult ​*> *​ _Nonnull results) {
       NSLog(@"show");
   } cancelled:^(NSArray<PermissionResult ​*>*​ _Nonnull results) {
       NSLog(@"cancelled");
   }];
}
@nickoneill
Copy link
Owner

Possibly a similar case to #147? Looks like you're doing things correctly so likely some issue with the async motion request.

@bre7 bre7 added the bug label Oct 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants