App discovers bluetooth devices only when ran from Xcode - ios

I'm working with a fork of this project for Empatica E4 wristbands and I'm unable to make the discover devices work without running the app from Xcode. The situation can be replicated with the original sample project.
When I ran the project through Xcode, I can see the list of nearby devices.
However, when I close the app and ran in from the phone (instead of clicking "play" on Xcode), I can't see any device.
Should I configure something on the Project or own a developer account? Right now I'm not paying a developer account but I thought I could do this without using Xcode to run the app. Thanks.
In short: I can open the app without connecting the phone to XCode but I can't discover devices when I'm not connected to XCode.
More details.
When executed through Xcode on the iphone, the device discover works. On the logs, we can see:
E4tester [didUpdate] status 2 • kBLEStatusScanning
bluetoothd Received XPC message "CBMsgIdScan" from session "Empatica.E4testerCV-central-313-24"
bluetoothd Received 'start scan' request without duplicates for all UUIDs from session "Empatica.E4testerCV-central-313-24"
bluetoothd State of application "Empatica.E4testerCV" is now "foreground-running"
However. When the app is opened on the iPhone (instead of ran via Xcode), we get the following log messages:
E4tester [didUpdate] status 0 • kBLEStatusNotAvailable
E4tester Task <EA813C26-F662-461C-8C47-A97FA7E32BA4>.<0> response ended
E4tester Task <EA813C26-F662-461C-8C47-A97FA7E32BA4>.<0> done using Connection 1
The important detail here is the kBLEStatusNotAvailable status, which contrasts with kBLEStatusScanning. According to their docs this means The iOS device does not support Bluetooth LE, or the Bluetooth LE module is not active. but the device does support BT LE and is enabled.
I opened an issue on their repository.

You need developer's account for testing Xcode apps in devices.
Developer account will give certificates and provisioning to run app in device. There is 2 certificates develop and distribution.
In your case you don't have any apple account. so maybe u are using freee provisioning
Please read this one to understand free provision:
Test iOS app on device without apple developer program or jailbreak
Maybe the capabilites on free provision is limited on debug mode *(runned from xcode)

In the end I got a direct answer from Empatica support team which I think is perfect since I sought an answer from credible and/or official sources.
Still, I would like to thank Antonio for his useful answer as well as Scriptable and Hichem for their messages.
The answer from Empatica E4 team is the following:
#carlosvega If you are working with an iPhone with iOS 11 or 12 you
should add the string NSBluetoothPeripheralUsageDescription in the
Info.plist file. The sample code has been created a while ago before
the privacy string was mandatory.
-- Empatica Engineering Team

Related

How can I run my own ios app on my iphone 6S with iOs 10.2?

I developed an app with XCode 8. However, I don't really find any help how to run my app on my own phone. There are just some tutorials for running it on my phone with XCode 7 but those don't really work for me.
Does somebody know how to do that ? Thank you !
Go to http://developer.apple.com and log in with your Apple developer account.
Create a developer certificate
Create an app id for your app
Create a provisioning profile
Download the provisioning profile and import it into Xcode.
Connect your iPhone to your computer. Select your iPhone in Xcode.
Build and run your app.
Or let Xcode do all that for you, since it happens automatically if Xcode is connected to your developer account.
This process is all documented on Apple's developer web site.
AFAIK you just need to:
Start Xcode
Unlock your iPhone
Connect your iPhone to your mac using the Lightning USB cable.
You should be asked (by Xcode) if you want to use the connected phone as a development device.
You can check, if the device is know to Xcode by clicking on Window / Devices. If you connect a device for the first time a little bit of 'magic' is going on that takes a while to complete.
Something like this maybe shown add 'Devices':

simulate xcode without development account

We have an app in Xcode from our old developers. We are in the registration process for an apple developer account, but on internet I read it can take a couple of weeks before it gets approved.
Is there a way I can simulate the app (like with TestFlight) without sending the actual code to potential new developers?
You can't distribute the app unless you have it signed/provisioned with needed UDIDs (which requires developer program). You can deploy it on your(s) device(s) using XCode though.
You should still be able to run the iOS simulator, which is generally the default behaviour for the build-and-run button - you can download more simulator environments in Xcode -> Preferences -> Components if you're missing one that you need.
Update: If you want third parties to run the app, there's no practical option apart from TestFlight. This is because iOS uses code signing to prevent trojan or pirated apps being installed on their devices. In that case you can consider other options which will achieve whatever your goals are, for example making a video of the app in use or setting up VNC access to a machine with the simulator (and code) on it.

Bluetooth diagnostics logs on iOS

I'd like to generate Bluetooth diagnostics logs on iPhone. I've installed Bluetooth Development Profile and I can click on "Save logs". But where can I find them and how can I transfer them to PC?
Preferably without iTunes, as on Windows I have very bad experience with this SW. I'm new to Apple ecosystem.
Thank you.
Your answer can be found in the Apple documentation here.
The steps are as follows.
Download and install the profile on your device (this can be done through Safari on the device).
Restart your device.
Reproduce any bluetooth commands you would like to diagnose.
Go to Settings > Bluetooth and select Diagnostic Mode
Add short description of the problem and tap Save
Sync device via iTunes (there doesn't seem to be a way to pull them manually without a rooted device).
Windows 7, 8, and Vista logs can be found at:
C:\Users\[Your_User_Name]\AppData\Roaming\Apple Computer\Logs\CrashReporter\MobileDevice\[Your_Device_Name]\BluetoothDiagnostics\
OSX logs can be found at:
/Users/[Your_User_name]/Library/Logs/CrashReporter/MobileDevice/[Your_Device_Name]/BluetoothDiagnostics/
The logs will be saved into timestamped folders like this Logs-2015.12.8-00.50.55/.

Testing Apps on a Device

When using trigger.io toolkit, there's an option that says
"Build and immediately run your app, either locally, on a simulator or on a connected device."
How do you run the app on a Connected Device? I want to see the app on my iPhone and see how it behaves directly. Is this possible?
Thanks
Marc
I'm going to assume you're working on windows with an iPhone that's iOS8 because that's where you currently can't run your app directly on a connected device.
What we did to "fix" this is creating a Development Provisioning Profile with the UDID's of our test devices and added this to config -> tools in the trigger.io toolkit. In the forge you now select package -> iOS giving you a .ipa file. This .ipa can now be installed using iTunes on your test devices.
It's a bit longer than just clicking run on device like you can for Android but at least you don't have to send it to testflight and wait for apple's approval.
This is possible but it depends on your os.
If your on a Mac you can deploy to both ios and android devices from forge, just connect them via usb and build, grated you need to make sure iTunes sees your devices etc.. there are guides on the trigger site
If you are on Windows, you are unfortunate out of luck right now, this used to work but ios8 broke this so if your building on ios7 you could still do it on Windows, otherwise you would need to use testpiolet from apple

Testing SMS in the iOS Simulator

Is it possible to open the message composer interface in the iPhone simulator in xcode? if it is can someone tell me how.. I really need it now and having hard times finding a solution how and why my code does not work on simulator.
It is not possible. This is one of the limitations of iOS Simulator. You also cannot test push notifications, iCloud, etc. If you need to test your code, you will have to join Apple's iOS Developer Program and test the app on your device. It's $99 per year.
Just as an update to this post, it's still true that you can't test these features on the iOS simulator; however, you CAN run your apps on your own personal device without having to pay for the $99/year developer license.
You can now just plug your phone in, wait for XCode to download and process some files, and then select your device from the "Devices" dropdown.
Here are a couple of resources that helped me out when getting this set up:
Xcode "Device Locked" When iPhone is unlocked
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/LaunchingYourApponDevices/LaunchingYourApponDevices.html
iOS Simulator is just a simulator that emulates the actual thing but Apple waters it down for developer usage. Many features are not available on the iOS Simulator because those features are not required for developers. Also Apple might have watered it down just to save storage and clear out unneeded features for iOS developers.

Resources