5 Replies Latest reply on Jul 17, 2018 3:26 PM by andrewjoecollins100_2736831

    Xcode BLE App Problem

    andrewjoecollins100_2736831

      Hi All,

       

      I was following the tutorial video of  "How to Make an iOS App to Control a Robot Using Bluetooth Low Energy (BLE)" , (link: http://www.cypress.com/training/how-make-ios-app-control-robot-using-bluetooth-low-energy-ble) but there was some error in building it. I downloaded the Xcode programming software of Xcode 9, but when I opened the project (which I got from the github) it says that the build editor version isn't compatible with the program.

       

      I noticed in the video Lesson 6 it says that the attached project would be in Xcode 7, so I tried that, but I got another error saying that the program wasn't compatible with the Xcode 7. Then, I downloaded Xcode 8, and then there were no build errors, but when I programmed it to my phone, it says that ios11.4 does not support Xcode 8.

       

      Can anyone please tell me how to update the program so that it would be suitable for Xcode 9?

       

      Any help would be appreciated,

      Andrew Collins

        • 1. Re: Xcode BLE App Problem
          ddka

          Method 1: Running the project on XCode 8

          XCode 8 doesn't support iOS 11 unless you have it in the DeviceSupport folder.

          To make XCode 8 run with iOS 11.4 device just do the following:

          1) Download XCode 9 with iOS 11

          2) Copy the iOS 11 Image file (which contains DeveloperDiskImage.dmg) into the following directory:

          /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/

          3) Restart XCode 8

           

          Method 2: Running the project on XCode 9

          Please try changing the build options and check which is compatible. If you aren't able to solve, just attach your error message so that I get a better understanding about the error.

           

          Regards,

          Dheeraj

          1 of 1 people found this helpful
          • 2. Re: Xcode BLE App Problem
            andrewjoecollins100_2736831

            Hey Dheeraj,

             

            I put the DMG file for iOS 11.4 into the Xcode 8 folder. After that, the program (PSoCLedCapsense) had no build errors and it ran on my iPhone! Thank you very much for your suggestion about running Xcode 8.

             

            Thanks,

            Andrew Collins

            • 3. Re: Xcode BLE App Problem
              andrewjoecollins100_2736831

              Hi,

               

              Although the Xcode 8 program works fine, I don't want to stick with this because it is an older version. When I use Xcode 8 and then switch to Xcode 9, there seem to be some glitches such as the simulators malfunctioning. So I tried to convert the Xcode 8 program to Xcode 9 and started with changing the Swift file from Swift 2.3 to Swift 4. When I did this about 50 errors came, and it would not convert the Swift file because it said 'build failed'. So I tried manually to fix these errors one-by-one, and after I completed and built the project they came back again. Is there any way to fix this?

               

              Thanks,

              Andrew

              • 4. Re: Xcode BLE App Problem
                ddka

                Please check if you have SWIFT_MODULE_NAME  under build settings set to your project name. Also, you can fix these issues using the auto fix option of XCode and then build the project.

                 

                Regards,

                Dheeraj

                1 of 1 people found this helpful
                • 5. Re: Xcode BLE App Problem
                  andrewjoecollins100_2736831

                  Hi,

                   

                  I used the auto-fix option in Xcode and now all of the errors are gone. However, when I run the app I find that it is having trouble connecting to any devices because nothing shows up in the Table View when I scan for devices. I tried testing to see if this was the case in CySmart, and apparently, it works in Cysmart but not in the Xcode app.

                   

                  In order to appease all of the errors, one of them I had to comment it out of the program because auto-fix was not working. The code is as follows:

                   

                  private func bleWriteInt8( val: Int8, char: CBCharacteristic)

                      {

                          //let ns = NSData(bytes: &val, length: sizeof(Int8))

                          //peripheral.writeValue(ns, forCharacteristic: char, type: CBCharacteristicWriteType.WithResponse)

                      }

                   

                  (The error that this gives is "Use of unresolved identifier 'sizeof'")

                   

                  I only commented whatever was inside this function so that there wouldn't be any other build issues, and I thought that since this only belonged to writing the LED characteristic, then it would not affect the connection to the device. Does this have anything to do with the connection of the device, or is the root of the problem somewhere else in the program?

                   

                  Please let me know.

                   

                  Thanks,

                  Andrew Collins

                  1 of 1 people found this helpful