SCNCamera.exposureOffset not working in iOS13 - swift

SCNCamera.wantsHDR is true. Yet any changes to SCNCamera.exposureOffset are not visible on iOS13 devices. But it is working perfectly fine on iOS12.
if let camera = self.sceneView.pointOfView?.camera {
camera.exposureOffset = -5
}

You said absolutely right, if someone wanna use exposureOffset instance property in SceneKit, he/she needs to activate a wantsHDR property at first:
var wantsHDR: Bool { get set }
In real code it might look like this:
sceneView.pointOfView!.camera!.wantsHDR = true
sceneView.pointOfView!.camera!.exposureOffset = -5
But there's a bug in iOS 13 and iOS 13 Simulator. However, if you disable allowsCameraControl, exposureOffset works fine.
sceneView.allowsCameraControl = false
Here's how exposureOffset changes from -2 to 2:

Related

Native Device Orientation issue in Flutter

I'm working with Flutter and I'm using Native Device Orientation Plugin
I'm trying to know the device orientation and manage my view based on that.
That plugin works really well, but I found an issue when I'm in page A which has a NativeDeviceOrientationReader and go to page B which has another NativeDeviceOrientationReader.
In this case, the page which is supposed to has a NativeDeviceOrientation.landscapeLeft will have NativeDeviceOrientation.landscapeRight even if I didn't change the orientation in the middle.
Note: If I rotate the phone after changing the page, it begins to work properly.
Also if I delete one of the NativeDeviceOrientationReader's it works ok too.
I'm using this code:
NativeDeviceOrientationReader(
builder: (context) {
NativeDeviceOrientation orientation = NativeDeviceOrientationReader.orientation(context);
var quarterTurns = 0;
if (orientation == NativeDeviceOrientation.landscapeLeft) {
quarterTurns = 3;
} else if (orientation == NativeDeviceOrientation.landscapeRight) {
quarterTurns = 1;
}
}
),
(...)
I don't know if somehow I have to close the reader or something.
Thanks in advance !
-------------- EDIT 1 --------------
Actually I didn't fix the issue, but I could resolve my problem changing one NativeOrientationReader to flutter OrientationBuilder, because I realized I didn't need the current rotation, I only wanted to know if the phone is landscape or portrait.
Thank you.

userDefaults reset / wiped after iOS 10.3 update

In my SpriteKit game I use UserDefaults to save high scores etc. Works fine, everything working smoothly.
however - I just updated some devices to iOS 10.3 (release, not beta) and I noticed that previously saved data is wiped...
new data is preserved - eg - a new high score is recorded, so the userDefaults are still being set once they are created.. but I wouldn't have expected 10.3 to wipe the old data ??
I imagine this is something to do with the new APFS ?
I have not tested this in any other apps yet - has anyone else seen this issue ? any idea how to prevent this happening in future ?
thanks.
example of setting a default: (Swift 3)
if (UserDefaults.standard.value(forKey: "highScoreLife") == nil) {
highScoreLife = 0
UserDefaults.standard.set(highScoreLife, forKey: "highScoreLife") } else {
highScoreLife = Int32(UserDefaults.standard.integer(forKey: "highScoreLife") as Int)
}

Phaser multitouch (on laptop trackpad)

I'm confused by how to skip the following condition when 1) holding down, and then 2) another tap on the screen to release the aim. I think the secondary tap becomes the activePointer so I'm quite puzzled.
var holding_down = game.input.activePointer.isDown;
if (holding_down && game.input.pointer2.isUp) { cue.aiming = true; }
UPDATE: Please note that for the solution accepted, I had to differentiate between desktop and mobile usage. pointer1 & pointer2 work fine on mobile, but on desktop I had to do the following.
if (desktop) {
var holding_down = game.input.activePointer.leftButton.isDown;
var second_tap = spacebar.isDown;
} else {
var holding_down = game.input.pointer1.isDown;
var second_tap = game.input.pointer2.isDown;
}
Also note you need to declare the desktop var after intantating the game object. I then set the var in the preload() function: desktop = game.device.desktop;, otherwise it was giving the wrong value. Thanks!
You're correct in that the secondary tap becomes the activePointer. Per the documentation, activePointer is "[t]he most recently active Pointer object."
Therefore, you'll want to make your checks against game.input.pointer1 and game.input.pointer2 instead.
So replace activePointer in your code with pointer1 and that might get you closer to what you were looking for.

SKAction scaleTo not working on iPhone 5S

I've found a strange behavior while using the iPhone 5S as development-target(Simulator and real device).
I'd like to scale a SKSpriteNode with an SKAction.scaleTo. This works fine on the iPhone 4S and the iPhone 5 simulator(Tested with iOS 7.0.3 and iOS 8).
But on the iPhone 5S simulator, the node doesn't scale. Also on my real iPhone 5S it doesn't scale.
Here is my code:
for tile in tileArray{
if(tile.color == searchColor){
var action = SKAction.scaleTo(0.5, duration: 0.5)
var action2 = SKAction.scaleTo(1, duration: 0.5)
tile.runAction(SKAction.repeatActionForever(SKAction.sequence([action, action2])))
}
}
EDIT:I've now found out, that the if-block doesn't get called on the iPhone 5S. I don't know why. For the other iPhones it works.
But as you see, the two colors are the same:
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
How is that possible?
Important: Other SKaction.scaleTo actions are working without any problems.
You are not comparing colors, you are comparing pointer values:
if(tile.color == searchColor)
This tests whether tile.color and searchColor both point to the same memory address. Depending on how the color is created, these addresses may be different. Try testing the individual color components as in:
if (tile.color.r == seachColor.r && tile.color.g == searchColor.b && etc ..)
Note that equality for floating point values is "relative".
The cause is the UIDeviceRGBColorSpace, which is different on the iPhone 5S. So I had to create an object-class which has also a name in it. Now I have to add the colornames to the class too, but I can compare the colors that way:
var color1 = ColorClass("myRed", color:theColor)
var color2 = ColorClass("myRed", color:theColor2)
if(color1.name == color2.name){
}
Of course this fix is really case-dependant. So for many others, this solution won't be good enough for their purposes.

Code doesn't work on iPhone but works on simulator

I have this code in my live chat.
if (TRUE && (balloonsOn != NO || !htmlStart)) {
balloonsOn = TRUE;
htmlStart = [self createChatLines: balloonsOn ? #"htmlformat-balloons" : #"htmlformat"];
if (chatLines > 0){
chatLines = 0;
[self updateView];
}
}
On the simulator it works fine but on the phone it doesn't work. It has worked before many times but now it stopped working on the phone. Why is this happening?
As far as I can see, there should be nothing that wouldn't work on the iPhone.. The only thing I can suppose, is you are using that strings without caring of the case-sensitiveness of iOs. The simulator is case insensitive but iOs is.. Let me know :)
What is the variable 'TRUE' ? I think having that as a variable name is probably the issue, rename it something else and see if it works.