How do I run my application from xcode on Apple Watch? - xcode

I am trying to run my first WatchKit application on Apple Watch (watchOS 7) from latest XCode (12.0).
I can select emulator as a destinantion, but I have no idea how to add my real watch to the list, so I can start testing on a real device.
I have iCloud account, and it seemed sufficient to run iPhone applications, but not Apple Watch.
How do I make it work?

Ok, I am not the sharpest tool in the shed.
Apart from assigning a proper Team to the Project, make sure you have your iPhone (to which the Apple Watch is paired) connected to your Mac via cable.
The "connect your iPhone using cable" was not thet obvious to me. I assumed it got the device from iCloud account.

Related

Xcode fails to install watchOS app onto Apple Watch device

Xcode "Run" operation fails to install a watchOS app on a real Apple Watch device with error description:
The host is not paired with the device.
Context:
First time ever trying to install a watchOS app from Xcode onto an Apple Watch device for testing/debugging
The watchOS app is an official Apple SwiftUI tutorial example
Assume latest versions of MacOS, Xcode, watchOS, Watch device, etc.
The selected scheme is the watchOS app target
The selected device is "[my Apple Watch name] via [my iPhone name]"
The Apple Watch is in fact paired with the companion iPhone, despite what the Xcode error says
The Apple Watch has not yet trusted this particular Xcode, Mac, developer account, or app. The Apple Watch should have received a "trust/don't trust" notification, but did not; this may be a bug on Apple's part.
However, we can force the notification to pop up by simply restarting the Apple Watch device. The Watch should receive the notification immediately upon restarting. Click "Trust" in the notification on the Watch. Then retry, from Xcode, the "Run" operation. The watchOS app should now install OK on the Apple Watch device.
What needs to be done is restarting both devices, iPhone and paired Apple Watch, connect iPhone to computer with cable. When the trust/don't trust notification appears on the Apple Watch or iPhone obviously choose 'trust'. Then the app will install again.
What it stops from running on your watch sometimes is if you have a simulator debug session open still. It says it can't install because there is another debug session running (but not on your watch..)! Closing this simulator session will allow you to install on your watch.
Other times xCode is building fine and thinks it's running the app on your watch, but it runs an old version and you don't see any changes made. Then you have to delete the app from your Apple Watch.
What also sometimes stops it from running on the Apple Watch are in Xcode the Preferences->Accounts->Profiles. Installing them manually will help in that case.
If nothing works uncouple your apple watch from your iPhone and recouple again.
Why isn't this still been resolved? I see people complaining about it for several of years now. Is this bug only related to standalone apps?

How to force an app to simulate in iPhone simulation using an iPad using Expo?

I'm currently using Expo to build an iPhone app.
I'm not supporting iPad and I have it so when it builds on iPad it runs in an iPhone Simulation.
The problem is I can't develop with Expo using this approach.
The app shows up as an iPad app, but this is not the mode being shipped to users.
According to this I might have some luck adding ios.supportsTablet to the app.json file and setting it to false but it didn't change anything.
Is there another configuration value I'm missing to force iPhone simulation mode on an iPad?
I'd rather not eject if I don't have to.
According to this, there currently isn't a way to live develop using "iPhone mode" on an iPad.
The Expo Client app can’t change its tablet support on the fly,
unfortunately, so it will always adapt your project to the iPad
viewport.
So, following the above forum here is how you get around it:
Run exp build:ios -t simulator
Open Simulator
Select Hardware/Device/iOs 11.x/iPad x generation
Unpack the generated build from the first command
You should have a file named yourApp.app
Drag that file into the iPad you are running in Simulator
It will install the app on the device and you can then view your creation
This is faster than doing a whole build cycle with TestFlight just to see your changes.
But it still leaves a bit to be desired.

Xcode and No paired Apple Watch

I've already seen a similar question that doesn't give a valid answer to me: In Xcode I see (no paired Apple Watch) even though the watch is paired and the watch's UDID is registered
I really cannot understand how to have my Apple Watch working on Xcode.
Even if I create a new project or if I add a watch target to an existing app I always see in the device choice this status "My iPhone (No paired Apple Watch)" but my Apple watch IS paired...
Sometimes the message changes and I get "My iPhone (Paired device not available for development)".
My current environment is fully updated to the latest software versions (Xcode, WatchOS, iOS and OS X).
Are there any magic solution to make it work?!
For what it's worth, I just ran into this problem. My phone and watch are both registered, etc. I checked my provisioning profiles on the developer portal and they happened to be invalid (I reset something along the way).
After fixing them, downloading, and double-clicking them, the watch appeared as paired again.
Just experienced this. It was caused because the ios app which contains the watch app was out of date on the phone. After switching target to the ios app and building and run it on my phone, I was then able to switch back to the watch app and successfully run it on my watch.
Xcode Version 8.2.1 (8C1002). macOS 10.12.3 (16D32).
On Xcode 10 beta, I experienced the (no paired Apple Watch) scenario
After a few moments, the "Do you trust this computer" dialogue came up on the watch. after accepting it, Xcode saw the watch right away

How to preview apps on iPad?

I am using xcode to develop a prototype application. Nothing too fancy, just slide effects and other simple gestures. Mostly moving images around the screen.
I can preview the app on my laptop using ios simulator, but how do I take the prototype to the iPad for a more realistic view?
Thank you
First, you need to join a paid iOS Developer Program or, if possible, the iOS University Program.
Then, you will have to create and install provisioning profiles using the steps in this documentation.
After that, you can test on iOS devices the same way you test on the Simulator.
Edit
Alleviate the need to go to the iOS Provisioning Portal every time you want to add a device to your provisioning profile by using automatic provisioning.
An easier way to install provisioning profiles is to let Xcode manage them for you. See the paragraph "To provision a device automatically for development" in this guide for more information.
This process requires a developer account with Apple - and you have to go through the Provisioning Portal to setup your provisioning profile. Apple recently came up with a great getting started guide:
https://developer.apple.com/programs/ios/gettingstarted/
Read the section on "Installing and Testing Apps on iPad, iPhone, and iPod touch".

How to limit iTunes App Store "Requirements" listing?

The iTunes AppStore auto generates some listings on its published pages. One of them is "Requirements:" and shows the devices that this app is compatible with. iPod, iPhone or iPad etc.
QUESTION: Where is this REQUIREMENTS listing set during the build process?
I have submitted an app that I 'thought' was properly configured because the Xcode settings for iPhone and NOT iPhone/iPad. But apparently this is either broken or I am totally confused as to where this is set and how its created on the AppStore.
Can someone enlighten me?
If you create an app that is iPod/iPhone only, it will still run on an iPad, just not as an iPad native app. That is to say, an iPhone/iPod-only app will run in an iPhone-sized window on an iPad. I do not think that you can say you want your iPhone app NOT to run on iPad.
When you select iPhone/iPad for your app type in Xcode, that is telling Apple and iTunes that your app binary is a universal app -- built for both platforms.
may be it's done by apple reviewers according to this guidelines limitation
App Store Review Guidelines:
2.10
iPhone apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution
... or else it will be rejected.
What's the problem? When you start a project you get to choose whether its for iPhone or iPad or both. When you submit it to apple this is also checked against your iOS build version and other things (normally though if there's a conflict it'll let you know before submission - eg: if you haven't included the iPad icons and your app says that its for iPad too).
In XCode4 theres a nice handy interface now that you can use. If you select your project in the left hand pane and click on your main target in the main window you can select the iOS application targets that your app is for.
In your Project settings Version, Device and Deployment Target are where the iTunes Requirements come from. If you choose only iPhone, then your requirements will inlcude iPod touch.
I believe this is the answer you are looking for:
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/App-RelatedResources/App-RelatedResources.html

Resources