Chapter 15 Page 269 Sandbox, InverseDeviceID, font problems

On page 269 after building on my iPhone 7+ I get

2017-06-08 11:23:54.047672-0600 MarbleMaze[6297:3266255] libMobileGestalt MobileGestaltSupport.m:153: pid 6297 (MarbleMaze) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-08 11:23:54.047785-0600 MarbleMaze[6297:3266255] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-06-08 11:23:54.713452-0600 MarbleMaze[6297:3266375] SKLabelNode: "Verdana-Bold " font not found.

Not sure what the sandbox error means
The InverseDeviceIDerror might be a bug in the latest Xcode (8.3.3) from searching on the web.
Third error, re font not found. Removing the trailing space gives the errors

2017-06-08 11:28:12.969047-0600 MarbleMaze[6305:3267664] libMobileGestalt MobileGestaltSupport.m:153: pid 6305 (MarbleMaze) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-08 11:28:12.969078-0600 MarbleMaze[6305:3267664] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)

Oh, and the ball drops immediately when the game screen appears…

Looks like the ball dropping is expected. I then get a crash at

} as! CMAccelerometerHandler

in CoreMotionHelper

Maybe need Privacy - Motion Usage Description required in info.plist

I changed the updateMotionControl() function to delete the call to getAcceleratorData called the CoreMotion functions directly modeled the 2D game, DropCharge. Only x and y needed.

func updateMotionControl()
{
if game.state == GameStateType.playing
{
// motion.getAccelerometerData(interval: 0.1, closure: { (x, y, z) in
// self.motionForce = SCNVector3(x: Float(x) * 0.05, y: 0, z: Float(y + 0.8) * -0.05)
// })
motionManager.accelerometerUpdateInterval = 0.1
let queue = OperationQueue()
motionManager.startAccelerometerUpdates(to: queue, withHandler:
{
accelerometerData, error in
guard let accelerometerData = accelerometerData else
{
return
}
let xAccel = accelerometerData.acceleration.x
let yAccel = accelerometerData.acceleration.y
self.motionForce = SCNVector3(x: Float(xAccel) * 0.05, y: 0, z: Float(yAccel + 0.8) * -0.05)
}
)
ballNode.physicsBody!.velocity += motionForce
}
}

Add import CoreMotion at the top of the GameViewController.swift and the variable motionManager to the class.

let motionManager = CMMotionManager()

I am now running into the same issue - I tried implementing your fix to no avail.

I recieve these errors when ever running the code from page 269 - the bal drops the sound plays but the camera does not follow or lock onto the ball. The messages from the console are as follows.

2017-08-04 21:09:59.491561-0700 MarbleMaze[5518:2265749] [DYMTLInitPlatform] platform initialization successful
2017-08-04 21:09:59.622104-0700 MarbleMaze[5518:2265685] Metal GPU Frame Capture Enabled
2017-08-04 21:09:59.622522-0700 MarbleMaze[5518:2265685] Metal API Validation Enabled
2017-08-04 21:09:59.670300-0700 MarbleMaze[5518:2265685] libMobileGestalt MobileGestaltSupport.m:153: pid 5518 (MarbleMaze) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-08-04 21:09:59.670380-0700 MarbleMaze[5518:2265685] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)

I have researched this quite a bit and others are getting this same error… anyone that know anything regarding this please reply.

Has anyone found a fix for this? The problem persists and nothing I have attempted works… I have simply skipped this game build altogether as nothing works beyond this point in this project.

I don’t have the code with me but I believe my solution worked. The problem was with the as! CMAccelerometerHandler statement.