No type or protocol named 'CLLocationManagerDelegate' in -Swift.h file2019 Community Moderator ElectionHow to change the name of an iOS app?How can I disable ARC for a single file in a project?How to download Xcode DMG or XIP file?MyLocation doesn't work in app (SWIFT3) Map KitHow to set current location into request.source Swift 3Location is returning nilTableView and cells not visible on UIControllerView Swift 4Swift Error - Use of undeclared type 'cell' - Collection ViewNo type or protocol named 'CLLocationManagerDelegate' in ProjectName-Swift.hHow to make the annotation appear on the Apple map via Swift?

Why does a Star of David appear at a rally with Francisco Franco?

Does this sum go infinity?

Is a party consisting of only a bard, a cleric, and a warlock functional long-term?

Adventure Game (text based) in C++

If I am holding an item before I cast Blink, will it move with me through the Ethereal Plane?

Recruiter wants very extensive technical details about all of my previous work

Simplify an interface for flexibly applying rules to periods of time

Why does energy conservation give me the wrong answer in this inelastic collision problem?

"of which" is correct here?

Planetary tidal locking causing asymetrical water distribution

What is "focus distance lower/upper" and how is it different from depth of field?

Did Ender ever learn that he killed Stilson and/or Bonzo?

How do I hide Chekhov's Gun?

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Custom alignment for GeoMarkers

How should I state my peer review experience in the CV?

How to make healing in an exploration game interesting

Examples of transfinite towers

Fastest way to pop N items from a large dict

Why did it take so long to abandon sail after steamships were demonstrated?

How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?

Is it normal that my co-workers at a fitness company criticize my food choices?

Can I use USB data pins as power source

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?



No type or protocol named 'CLLocationManagerDelegate' in -Swift.h file



2019 Community Moderator ElectionHow to change the name of an iOS app?How can I disable ARC for a single file in a project?How to download Xcode DMG or XIP file?MyLocation doesn't work in app (SWIFT3) Map KitHow to set current location into request.source Swift 3Location is returning nilTableView and cells not visible on UIControllerView Swift 4Swift Error - Use of undeclared type 'cell' - Collection ViewNo type or protocol named 'CLLocationManagerDelegate' in ProjectName-Swift.hHow to make the annotation appear on the Apple map via Swift?










0















I know i am not the first one to ask, and i'll probably won't be the last, but I haven't seen anything that helped me, so I'll ask anyway. I am trying to use some swift and objective-C for my Unity app, and I managed to do that much. But, as I am trying to use get my location in the background, I am trying to use CLLocationManagerDelegate like so:



Example.swift:



import Foundation
import CoreLocation
import CoreLocation.CLLocationManagerDelegate
import UIKit

@objc class Example : NSObject
@objc static func StartTracking()

var att: FindMeTask = FindMeTask();
att.StartTracking()




class FindMeTask: UIViewController, CLLocationManagerDelegate
var bgtask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid;

var coord: Coor = Coor()

private lazy var locationManager: CLLocationManager =
let manager = CLLocationManager()
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.delegate = self
manager.requestAlwaysAuthorization()
manager.allowsBackgroundLocationUpdates = true
return manager
()

public func StartTracking()
locationManager.delegate = self;
locationManager.startUpdatingLocation()


func locationManager(_ manager: CLLocationManager, didUpdateLocations
locations: [CLLocation])

guard let mostRecentLocation = locations.last else
return

let lat : Double = (mostRecentLocation.coordinate.latitude)
let lon : Double = (mostRecentLocation.coordinate.longitude)
coord.SetCoord(aLat: lat, aLon: lon)
if(UIApplication.shared.applicationState == .active)
print("In foreground")
else
print("In background, location is %@", coord)





Example.mm



#import <Foundation/Foundation.h>
#import "unityswift-Swift.h"
#import <CoreLocation/CoreLocation.h>
#import <CoreLocation/CLLocationManagerDelegate.h>

extern "C"
void _startTracking()
[Example StartTracking];




And finally, my UnitySwift-Bridging-Header.h



#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "UnityInterface.h"
#import "CoreLocation/CoreLocation.h"
#import "CoreLocation/CLLocationManagerDelegate.h"


So, with that code, it gives me this error: No type or protocol named 'CLLocationManagerDelegate' in my name-Swift.h when it tries to declare the @interface of my FindMeTask (@interface FindMeTask : UIViewController ).
Also, maybe it will help, I cannot extend an interface created in my .mm file by CLLocationManagerDelegate (like this: @interface test : CLLocationManagerDelegate)



I have tried many thing, but none have worked as of right now. If someone knows anything and could help, that would be great! Thanks in advance!










share|improve this question


























    0















    I know i am not the first one to ask, and i'll probably won't be the last, but I haven't seen anything that helped me, so I'll ask anyway. I am trying to use some swift and objective-C for my Unity app, and I managed to do that much. But, as I am trying to use get my location in the background, I am trying to use CLLocationManagerDelegate like so:



    Example.swift:



    import Foundation
    import CoreLocation
    import CoreLocation.CLLocationManagerDelegate
    import UIKit

    @objc class Example : NSObject
    @objc static func StartTracking()

    var att: FindMeTask = FindMeTask();
    att.StartTracking()




    class FindMeTask: UIViewController, CLLocationManagerDelegate
    var bgtask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid;

    var coord: Coor = Coor()

    private lazy var locationManager: CLLocationManager =
    let manager = CLLocationManager()
    manager.desiredAccuracy = kCLLocationAccuracyBest
    manager.delegate = self
    manager.requestAlwaysAuthorization()
    manager.allowsBackgroundLocationUpdates = true
    return manager
    ()

    public func StartTracking()
    locationManager.delegate = self;
    locationManager.startUpdatingLocation()


    func locationManager(_ manager: CLLocationManager, didUpdateLocations
    locations: [CLLocation])

    guard let mostRecentLocation = locations.last else
    return

    let lat : Double = (mostRecentLocation.coordinate.latitude)
    let lon : Double = (mostRecentLocation.coordinate.longitude)
    coord.SetCoord(aLat: lat, aLon: lon)
    if(UIApplication.shared.applicationState == .active)
    print("In foreground")
    else
    print("In background, location is %@", coord)





    Example.mm



    #import <Foundation/Foundation.h>
    #import "unityswift-Swift.h"
    #import <CoreLocation/CoreLocation.h>
    #import <CoreLocation/CLLocationManagerDelegate.h>

    extern "C"
    void _startTracking()
    [Example StartTracking];




    And finally, my UnitySwift-Bridging-Header.h



    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
    #import "UnityInterface.h"
    #import "CoreLocation/CoreLocation.h"
    #import "CoreLocation/CLLocationManagerDelegate.h"


    So, with that code, it gives me this error: No type or protocol named 'CLLocationManagerDelegate' in my name-Swift.h when it tries to declare the @interface of my FindMeTask (@interface FindMeTask : UIViewController ).
    Also, maybe it will help, I cannot extend an interface created in my .mm file by CLLocationManagerDelegate (like this: @interface test : CLLocationManagerDelegate)



    I have tried many thing, but none have worked as of right now. If someone knows anything and could help, that would be great! Thanks in advance!










    share|improve this question
























      0












      0








      0








      I know i am not the first one to ask, and i'll probably won't be the last, but I haven't seen anything that helped me, so I'll ask anyway. I am trying to use some swift and objective-C for my Unity app, and I managed to do that much. But, as I am trying to use get my location in the background, I am trying to use CLLocationManagerDelegate like so:



      Example.swift:



      import Foundation
      import CoreLocation
      import CoreLocation.CLLocationManagerDelegate
      import UIKit

      @objc class Example : NSObject
      @objc static func StartTracking()

      var att: FindMeTask = FindMeTask();
      att.StartTracking()




      class FindMeTask: UIViewController, CLLocationManagerDelegate
      var bgtask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid;

      var coord: Coor = Coor()

      private lazy var locationManager: CLLocationManager =
      let manager = CLLocationManager()
      manager.desiredAccuracy = kCLLocationAccuracyBest
      manager.delegate = self
      manager.requestAlwaysAuthorization()
      manager.allowsBackgroundLocationUpdates = true
      return manager
      ()

      public func StartTracking()
      locationManager.delegate = self;
      locationManager.startUpdatingLocation()


      func locationManager(_ manager: CLLocationManager, didUpdateLocations
      locations: [CLLocation])

      guard let mostRecentLocation = locations.last else
      return

      let lat : Double = (mostRecentLocation.coordinate.latitude)
      let lon : Double = (mostRecentLocation.coordinate.longitude)
      coord.SetCoord(aLat: lat, aLon: lon)
      if(UIApplication.shared.applicationState == .active)
      print("In foreground")
      else
      print("In background, location is %@", coord)





      Example.mm



      #import <Foundation/Foundation.h>
      #import "unityswift-Swift.h"
      #import <CoreLocation/CoreLocation.h>
      #import <CoreLocation/CLLocationManagerDelegate.h>

      extern "C"
      void _startTracking()
      [Example StartTracking];




      And finally, my UnitySwift-Bridging-Header.h



      #import <Foundation/Foundation.h>
      #import <UIKit/UIKit.h>
      #import "UnityInterface.h"
      #import "CoreLocation/CoreLocation.h"
      #import "CoreLocation/CLLocationManagerDelegate.h"


      So, with that code, it gives me this error: No type or protocol named 'CLLocationManagerDelegate' in my name-Swift.h when it tries to declare the @interface of my FindMeTask (@interface FindMeTask : UIViewController ).
      Also, maybe it will help, I cannot extend an interface created in my .mm file by CLLocationManagerDelegate (like this: @interface test : CLLocationManagerDelegate)



      I have tried many thing, but none have worked as of right now. If someone knows anything and could help, that would be great! Thanks in advance!










      share|improve this question














      I know i am not the first one to ask, and i'll probably won't be the last, but I haven't seen anything that helped me, so I'll ask anyway. I am trying to use some swift and objective-C for my Unity app, and I managed to do that much. But, as I am trying to use get my location in the background, I am trying to use CLLocationManagerDelegate like so:



      Example.swift:



      import Foundation
      import CoreLocation
      import CoreLocation.CLLocationManagerDelegate
      import UIKit

      @objc class Example : NSObject
      @objc static func StartTracking()

      var att: FindMeTask = FindMeTask();
      att.StartTracking()




      class FindMeTask: UIViewController, CLLocationManagerDelegate
      var bgtask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid;

      var coord: Coor = Coor()

      private lazy var locationManager: CLLocationManager =
      let manager = CLLocationManager()
      manager.desiredAccuracy = kCLLocationAccuracyBest
      manager.delegate = self
      manager.requestAlwaysAuthorization()
      manager.allowsBackgroundLocationUpdates = true
      return manager
      ()

      public func StartTracking()
      locationManager.delegate = self;
      locationManager.startUpdatingLocation()


      func locationManager(_ manager: CLLocationManager, didUpdateLocations
      locations: [CLLocation])

      guard let mostRecentLocation = locations.last else
      return

      let lat : Double = (mostRecentLocation.coordinate.latitude)
      let lon : Double = (mostRecentLocation.coordinate.longitude)
      coord.SetCoord(aLat: lat, aLon: lon)
      if(UIApplication.shared.applicationState == .active)
      print("In foreground")
      else
      print("In background, location is %@", coord)





      Example.mm



      #import <Foundation/Foundation.h>
      #import "unityswift-Swift.h"
      #import <CoreLocation/CoreLocation.h>
      #import <CoreLocation/CLLocationManagerDelegate.h>

      extern "C"
      void _startTracking()
      [Example StartTracking];




      And finally, my UnitySwift-Bridging-Header.h



      #import <Foundation/Foundation.h>
      #import <UIKit/UIKit.h>
      #import "UnityInterface.h"
      #import "CoreLocation/CoreLocation.h"
      #import "CoreLocation/CLLocationManagerDelegate.h"


      So, with that code, it gives me this error: No type or protocol named 'CLLocationManagerDelegate' in my name-Swift.h when it tries to declare the @interface of my FindMeTask (@interface FindMeTask : UIViewController ).
      Also, maybe it will help, I cannot extend an interface created in my .mm file by CLLocationManagerDelegate (like this: @interface test : CLLocationManagerDelegate)



      I have tried many thing, but none have worked as of right now. If someone knows anything and could help, that would be great! Thanks in advance!







      ios objective-c swift xcode unity3d






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 6 at 20:52









      NjalaNjala

      11




      11






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031947%2fno-type-or-protocol-named-cllocationmanagerdelegate-in-swift-h-file%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031947%2fno-type-or-protocol-named-cllocationmanagerdelegate-in-swift-h-file%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко