Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
Documentation
Example Apps

Example Apps

SDL provides two example apps: one written in Objective-C and one in Swift. Both implement the same features.

The example apps are located in the sdl_ios repository. To try them, you can download the repository and run the example app targets, or you can use pod try SmartDeviceLink with CocoaPods installed on your Mac.

Note

If you download or clone the SDL repository in order to run the example apps, you must first obtain the BSON submodule. You can do so by running git submodule init and git submodule update in your terminal when in the main directory of the cloned repository.

The example apps implement soft buttons, template text and images, a main menu and submenu, vehicle data, popup menus, voice commands, and capturing in-car audio.

Connecting to an Infotainment System

Emulator

You can use a simulated or a real device to connect the example app to an emulator. To connect the example app to Manticore or another emulator, make sure you are on the TCP Debug tab of the example app. Then type in the IP address and port number and press the "Connect" button. The button will turn green when you are connected. Please check the Connecting to an Infotainment System guide for more detailed instructions on how to get the emulator's IP address and port number.

Head Unit

You need a real device to connect the example app to production or debug hardware. After building the running the app, make sure you are on the iAP tab of the example app and press "Connect". The button will turn green when you are connected.

If using the Bluetooth (BT) transport, make sure to first pair your phone to the hardware before attempting to connect your SDL app. If using the USB transport, you will need to connect your phone to the hardware using a USB cord.

If the hardware supports both BT and USB transports, only one transport will be supported at once. If your phone is connected via BT and you then connect the phone to the head unit via a USB cord, the library will close the BT session and open a new session over USB. Likewise, when the USB cord is disconnected, the library will close the USB session and open session over BT.

Troubleshooting

If your app compiles and but does not show up on the HMI, there are a few things you should check:

TCP Debug Transport

  1. Make sure the correct IP address and port number is set in the SDLLifecycleConfiguration.
  2. Make sure the device and the SDL Core emulator are on the same network.
  3. If you are running an SDL Core emulator on a virtual machine, and you are using port forwarding to connect your device to the virtual machine, the IP address should be the IP address of your machine hosting the VM, not the IP address of the VM. The port number will be 12345.
  4. Make sure there is no firewall blocking the incoming port 12345 on the machine or VM running the SDL Core emulator. Also make sure your firewall allows that outgoing port.
  5. Your SDL app will not work when the device app is in the background, because the OS will terminate background tasks after a short amount of time. This is not an issue with production IAP connections because Apple's External Accessory framework allows your app unlimited background time.
  6. If you have a media SDL app, audio will not play on the emulator. Only production IAP connections are currently able to play audio because this happens over the standard Bluetooth / USB system audio channel.
  7. You cannot connect to any of our open-source emulators using a USB cord or Bluetooth because Apple's MFi Program is confidential and can not be used in open source projects.

iAP Production Transport

  1. Make sure to use the default SDLLifecycleConfiguration.
  2. Make sure the protocol strings have been added to the app.
  3. Make sure you have enabled background capabilities for your app.
  4. If the head unit (emulators do not support IAP) does not support Bluetooth, an iAP connection requires a USB cord.

iAP Bluetooth Production Transport

  1. Bluetooth transport support is automatic when you support the iAP production transport. It cannot be turned on or off separately.
  2. Make sure the head unit supports Bluetooth transport for iPhones. Currently, only some head units support Bluetooth.
  3. Make sure Bluetooth is turned on - both on the head unit hardware and your iPhone.
  4. Ensure your iPhone is properly paired with the head unit.
View on GitHub.com
Previous Section Next Section