App accelerometer behaves differently when plugged into Xcode - swift

Working on game where you move ship by titling screen.
Using Landscape right mode.
If device not flat the ship moves so i needed to calibrate the Y tilt when the app is run so that is neutral up/down movement.
I got it to work by reading the tilt when app was run and making that neutral.
Anyway, it works fine (took me hours to figure it out but I did it!)
It works great when I have my iPhone plugged in to MacBook and run it through Xcode.
But if I run it when the phone is not connected to Xcode - it does not work.
It acts like the calibration I set up was not even there.
I set it up to catch the Y tilt angle when you launch the app "view did load".
Works great when plugged in but not when not plugged to Xcode.
I tried force quit-relaunch, even reset phone and launch app again.

Related

Aframe mobile can't detect orientation of the device

I'm working on a project with A-Frame. My problem is that when I open from my iPhone (model Xs Max) even the easiest example code moving the device will not change the camera rotation. But when i go to https://aframe.glitch.me/ this one works even if it is the same code. The device motion and orientation is enabled in iPhone settings. What am I missing?

DualTouchControls (Jump) in Unity 5 build for iOS does not detect a screen click

I am currently encountering issues with detecting a touch for an iOS test game. I have imported the Cross PlatformInput library provided by Unity and did include the DualTouchControls in my Scene like so:
When I run the app on my phone I can see the black box but when I press the screen it does not jump my rocket (character). These are the settings of my Jump DualTouchControl:
And here is the rocket itself with its game environment:
What would I like to achieve?
I would like to jump the rocket whenever a user taps his screen on his mobile phone. Previously I didn't work with the DualTouchControls because I mainly build it for desktop for testing purposes. It works perfectly on desktop tho using the spacebar.
Hopefully someone can help me out with some tips.

Iphone resolution on an Ipad

We have an app that has been rejected in the review process by the Apple app review people. The cause for the rejection is that the app is not scaling properly when run on an Ipad.
The app was never meant to be run on an Ipad, but there seems to be no point in arguing with them about that.
Apple sent us a couple of screenshots that show our app being run on an Ipad with the top portion of the view cut off. Notice how the app is run in some mode where it looks like an Iphone app and does not fill out the entire display area. When we bring up the app on an Ipad, it fills out the screen and does so without any edges cut off.
Can anyone please tell me how to run the app on an Ipad the way the Apple guys have - Iphone-sized? We believe we have a fix for the issue but we need to reproduce the error and then be able to verify that the fix solves the issue.
(the logotypes in the images are intentionally blurred)
I just went through this myself and here is how I resolved it:
Go into info.plist and see if any of the supported interface orientations are set for iPad. Despite selecting iPhone only, I had iPad supported orientations for four (portrait, portrait upside down, landscape left, landscape right). I deleted those.
I also deleted any reference to the launch screen in the info.plist. My app is pretty simple and there's no preloading of data so I don't really need a launch screen. If you do, you could go old school and make your first VC the launch screen.
I then made these changes in Target-->General-->App Icons and Launch Images
That was the only way I could get it in the sim to run the app at iPhone resolution while running an iPad (iPad2, iPad Air).
If Apple is going to force developers to ensure an app runs on an iPad even if it is made just for iPhone, they should eliminate the iPhone Only and Universal options and just have iPad Only as an option.
To run an iPhone app on an iPad, you just need to:
Acquire an iPad (you can also use the simulator)
Set the target device family in Xcode (it's under your target) to iPhone
Connect your iPad, perform any necessary certificate dances
Run the app on the iPad.
As long as the target device family is set to iPhone, the iPad will show your app in this mode.
Apple is likely running your app on a simulator, not on a real device. Notice the "2X" on the top right. In XCode - you should run the app on iPad Retina Simulator. On the bottom right you will see a button that you can toggle from 1X to 2X.
If you place the simulator in "2X" mode, you will see what Apple is seeing.
What OS are you running on your iPad? Things have changed in iOS 8 - and that's likely why you're not seeing what Apple is seeing. My guess is that your are running an app that was initially developed for iOS 7 or earlier - which means that you need to upgrade from scaled resolution to native resolutions to resolve this issue. Here is how you do it:
How to enable native resolution for apps on iPhone 6 and 6 Plus?

App won't respond until rotation/2x occurs on iPad3

I am wondering if anyone else has had this happen to them. I have a iPhone App that I have been updating for over a year and it has been working just fine on my iPad2, iPhone 3GS, as well as the 4G, 4GS, and 5. However, just recently I obtained an iPad3 to test the App on. Something very strange happens: When the App is loaded through Xcode in development it comes up and looks perfect - however, it won't respond to any touches at all. I have an alert that pops up on load and you can close that, but the actual main view controller will not react to any drag or touch gestures - it is essentially frozen. However! When I rotate the device and the App rotates correctly, it suddenly starts working just fine, even if I rotate it back! The simulator for the iPad running iOS6 in normal and retina does the same thing even though it works just fine on my iPad2. However, the simulator for the iPhone works just fine.
Like I said, this doesn't happen on any other device. Even loaded the same way all devices allow tapping like normal. Here is what I have been able to confirm:
iPad3 device: frozen
iPad-retina sim: frozen
iPad-normal sim: frozen
iPad2 device: normal
iPhone-retina sim: normal
iPhone-normal sim: normal
iPhone 4S device: normal
iPhone 4 device: normal
If all the iPhones worked and the iPads didn't, it would make some sense. But my ipad2 works just fine. Also, if I use the iPad3 open it, it is frozen. BUT! If I hit the 2X button, it starts working again even without rotation.
I also decided to test and see if it would work as a Universal App. On the iPad3 when I switch it over to Universal, it works just fine to begin with. So something weird must be going on with the simulator. Any ideas?
Thanks!!
-Mark
A view (in your case the whole thing) not accepting any input often means that one of the superviews has a frame smaller than its contents. This could be the case here, strangely only in specific situations, upon rotation the view frame gets the correct size and stays correct afterwards.
Did you solve this in the meantime? You can try to give the views different transparent background colors and/or make them clipToBounds, starting with the top view controller's view. That way you'll see if something is wrong with the frames.

Developing iPhone app to Run on iPad - Auto Set 2x

Is there a way to programmatically set the iPad to run the iPhone app at 2x as it is launched (yet keep the iPhone app native). I understand I can create NIB files for each hardware platform, but for ease, I just would rather the app launch as if the user had tapped the 2x on the iPad. Thanks...R.J.
No. The pixel-doubling malarkey is not under your app's control, and is pretty much a crutch for apps that weren't designed for the iPad. If you didn't go nuts with specific pixel measurements in the original code, it shouldn't be difficult to move to the larger screen.
It's not quite program control, but you can get an app to start up in 2x mode on iOS 4.2.
I've had a couple of apps that have always started up in 2x mode, and very nice it was too, but I only worked out why this was today!
Steps:
Run iPhone app (e.g., from Xcode)
Use '1x' and '2x' buttons to select desired zoom level
Press home button to get back to launcher
Double tap home button to bring up task manager
Kill your app (hold finger down until icons start to dance, then press the '-' button on your app's icon)
(If you ran under the debugger in step 1, Xcode will tell you the program got a SIGKILL, and might stop somewhere random in the call stack; you can ignore this.)
Now next time you run the program, it will start up with the zoom level you selected in step 2!
I didn't test absolutely every method of closing the program, but this preference doesn't get saved if you stop it from Xcode (e.g., using Run|Stop menu item), and it doesn't get saved if your program terminates using exit. Closing it using the launcher is the only way I've found so far...