FLIR One Developer / Blog / Topics / bridging-header, Swift / Support iOS SDK with Swift3, IOS 10, Xcode 8.2.1?

Support iOS SDK with Swift3, IOS 10, Xcode 8.2.1?

Home Forums FLIR ONE SDK Development iOS development Installation and getting started Support iOS SDK with Swift3, IOS 10, Xcode 8.2.1?

This topic contains 5 replies, has 4 voices, and was last updated by Profile photo of Cem Dogan Cem Dogan 1 year, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)

  • Author

    Posts

  • #5124

    Profile photo of Jordi
    Jordi

    Participant

    Good Morning,

    I would like to know if the SDK is compatible with Swift 3, IOS 10 and Xcode 8.2.1 🙂 !!

    Could you give us an installation guide?

    I tried with the start guide but I get error like these:

    class ViewController: UIViewController, FLIROneSDKImageReceiverDelegate, FLIROneSDKStreamManagerDelegate { // the error is: Use of undeclared type ‘FLIROneSDKStreamManagerDelegate’

    @IBOutlet weak var imageView: UIImageView!

    override func viewDidLoad() {
    super.viewDidLoad()

    FLIROneSDKStreamManager.sharedInstance().addDelegate(self) // Use unresolved identifier FLIROneSDKStreamManagerDelegate

    if let options = FLIROneSDKImageOptions(rawValue:
    (FLIROneSDKImageOptions.blendedMSXRGBA8888Image.rawValue) | (FLIROneSDKImageOptions.thermalRadiometricKelvinImage.rawValue)) { // Use unresolved identifier FLIROneSDKImageReceiverDelegate

    FLIROneSDKStreamManager.sharedInstance().imageOptions = options // Use unresolved identifier FLIROneSDKStreamManagerDelegate
    }
    }

    func flirOneSDKDelegateManager(_ delegateManager: NSObject!, didReceiveBlendedMSXRGBA8888Image msxImage: Data!, imageSize size: CGSize) {

    let image = FLIROneSDKUIImage(format: FLIROneSDKImageOptions.blendedMSXRGBA8888Image, andData: msxImage, andSize: size) // Use unresolved identifier FLIROneSDKImageReceiverDelegate

    DispatchQueue.main.async {
    self.imageView.image = image;
    self.reflection.image = image;
    }
    }

    override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
    }

    }

    Thank you, I need your help !

    Best regards !!

    #5126

    Profile photo of Tim Liew
    Tim Liew

    Moderator

    Hi Jordi,

    The iOS SDK does support iOS 10 and the latest version of XCode, but the iOS SDK does not currently officially support Swift, however, I believe some other developers on the forums have been able to successfully use Swift with the SDK.

    Best,
    Tim

    #5136

    Profile photo of Jordi
    Jordi

    Participant

    Hi 🙂 !
    Abaout your comment “I believe some other developers on the forums have been able to successfully use Swift with the SDK” where 😀 ?

    I’m searching the internet and I do not see how to use FLIR ONE in swift 3. Can you help me?
    Thank you very much

    #5195

    Profile photo of Andrew
    Andrew

    Participant

    Jordi,
    I had success with iOS 9 and Swift 2 but when I updated to Xcode 8.2, some bugs were introduced that still need fixing. In my experience in the earlier version on Xcode that still allowed Swift 2, I had to edit the FLIR API because the bridging-header mechanism didn’t make the FLIROneSDKDelegateManager available in swift. This doesn’t seem to be a problem in Xcode 8.3.
    Your error messages seem to indicate that you haven’t been able to import the headers for the FLIR API. Two questions arise in my head immediately, did Xcode produce a <ProjectName>-Bridging-Header.h file in the main group of your project, where <ProjectName> is the name of your project? If not, you may have to manually add it, http://www.learnswiftonline.com/getting-started/adding-swift-bridging-header/ . OR if so, does that header have #import <FLIROneSDK/FLIROneSDK.h> in it? If the answer to one of those is no, I think that we may have solved your error messages. Otherwise I am not sure.

    That said, my project still doesn’t work even though it compiles. I am stuck at

        func flirOneSDKDelegateManager(_ delegateManager: FLIROneSDKDelegateManager!, didReceiveBlendedMSXRGBA8888Image msxImage: Data!, imageSize size: CGSize) {
            if let image = FLIROneSDKUIImage(format: FLIROneSDKImageOptions.blendedMSXRGBA8888Image, andData: msxImage, andSize: size) {
    

    The image file produced is nonsense. I have a feeling that it has something to do with the change from NSData to Data when switching from Swift 2 to 3, like the data elements are not in the same order or are assumed to be the wrong length. I have a suspicion that I need to step through msxImage and reconstruct a new input for the data parameter of FLIROneSDKUIImage(

    Let me know whether my info helped you get past your error messages and whether you run into a similar problem with your images.

    #5231

    Profile photo of Andrew
    Andrew

    Participant

    Update to my last post. It seems that my app works for iOS 10 except for the demo on the simulator. On my 6s in either demo mode or with the FLIROne attached, everything works. It was the demo on the sim that was tricking me. @Jordi check out my project. Since I have problems with the sim I cannot guarantee that it works on other phones/ipads but it seems to on the 6s.

    #6081

    Profile photo of Cem Dogan
    Cem Dogan

    Participant

    Hi Everyone,

    I am new to Flir One Pro. Do you know if there is a Swift 4 version of the SDK?

    Best,

    Cem

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.