-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Swift 4.2 #20
Comments
Hi, |
Okay, I'll get this sorted within the next couple of hours. Stay tuned... I keep forgetting about this with each new Swift version, because I'm always building LocoKitCore from source, so I don't notice the binary incompatibility. Swift 5.0's ABI stability can't come soon enough! |
Okay, I've uploaded a LocoKitCore built with Swift 4.2 to the pod 'LocoKit', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'develop'
pod 'LocoKit/LocalStore', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'develop'
pod 'LocoKitCore', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'develop' You'll also need to migrate your code to LocoKit 6.0 API changes. They're fairly minor, and some of them Xcode will provide fixits for anyway. The main difference is that let store = PersistentTimelineStore()
var recorder: TimelineRecorder
func startup() {
recorder = TimelineRecorder(store: store)
recorder.startRecording()
} Or if you're using activity type classifiers: func startup() {
LocoKitService.apiKey = "<insert your API key here>"
recorder = TimelineRecorder(store: store, classifier: TimelineClassifier.highlander)
recorder.startRecording()
} If you're not using TimelineManagers at all, then your code probably won't have to change, except for the renames which Xcode will provide fixits for. |
Oh, I forgot to mention that the LocoKitCore binary doesn't include sim archs. Xcode 10 didn't want to do it, for some reason, and I haven't had time to debug it yet. It's generally a bad idea to be doing any dev work in the sim anyway, unless absolutely necessary. I also haven't spent much/any time testing the non persistent timeline store in v6.0.0 yet. So if you've been using |
Thanks, I will try out this today. |
Thanks! It looks like there are still a few things that are not ready for Swift 4.2, such as It also looks like there is now a "hard" dependency between LocoKit and LocoKit/LocalStore. Previously I was able to just reference the first one in my Podfile, but now I'm forced to reference all three pods (including LocoKitCore) because of a reference to Thank you anyway. |
Ah, for those ones you can probably get around them by manually changing the Swift version for the LocoKit pod target in Xcode to Swift 4 instead of Swift 4.2. Edit: Also, I should add this to the podspec, given that that's possible to do now.
Oops! Ok, I'll get that fixed shortly. Looks like
In LocoKit 6.0 |
Yes, I meant As for the |
If you're not using the persistent store / timelines, then the combo you want is let store = TimelineStore()
var recorder: TimelineRecorder
func startup() {
recorder = TimelineRecorder(store: store)
recorder.startRecording()
} Is that not working? It's not letting you create a
I just checked, and the podspec was already specifying Swift 4.1, but using the old style workaround way of doing it. I guess that's not working properly anymore. I'm about to push a change to the podspec which uses CocoaPods' new way of specifying the Swift version. Hopefully that will make Xcode happy. |
@poulpix Give it another try now. I've committed a bunch of changes that should fix all those problems. What worries me more is that the non persistent store might not be retaining timeline items that it needs to retain, so they'll get released before they've finished being processed and finalised. That's the main remaining todo item on #11, which I haven't had a chance to get to yet. Will be interesting to see how it performs. I suspect not well, unless the items are retained after creation by something external. |
Brilliant! Everything compiles fine now, I've been able to remove the explicit reference to LocoKit/LocalStore. The NB : I think the As for how it performs, it needs some field testing now... Thank you very much |
Yeah, I didn't expect that! It doesn't seem intuitive to me. I'd prefer Swift to use the same visibility for the implicit init() method as the class itself, so if the class is public, the implicit init() is public. But I guess the Swift team have different ideas.
Yeah, they've changed a bunch of enums in Swift 4.2. The old podspec was using a hack to get CocoPods to add the correct Swift version to the project, and that hack no longer works. But they've replaced it with a proper
I'd pay special attention to the results of the timeline item processing. LocoKit 5.0 kept strong references to an array of It's on my todo list to create a replacement for |
I tried it too. I'm using the LocoCore and LocoKit pods, it's working well. |
I'm trying to compile the demo app under Xcode 10: Can you point me to my mistake? |
It only works on device, not in simulator. |
Yeah, the LocoKitCore binary in the develop branch doesn't include the sim archs, so it will only run on device. In general I also strongly advice not doing any location based dev work in the sim. The sim produces CLLocation data that doesn't match any real world conditions (eg the horizontalAccuracy is returned as an impossible 0). It also doesn't produce any CoreMotion data. |
Thats true, but on the other hand its pretty hard to make routes on the device in front of a computer :D |
This leads me to a tangent that's been playing on my mind for a while. I meant to file a new task last week for the maintenance of some "test databases", with the goal of being able to do test processing runs over a series of pre recorded samples. So far I've found automated testing to be effectively impossible for the core "ActivityBrain" engine, due to the requirement of a steady flow of CoreLocation and CoreMotion data inputs, where the timing of the inputs is significant. If it's not receiving inputs with effectively real world timings and values, there's very little point in testing it at all. The tests simply wouldn't be useful. But what can be tested is the results of the timeline processing engine(s) (TimelineProcessor et al). So what I plan to do is record one or more sessions, with several hours of travel + stationary data, then keep those as "test databases". That would allow processing to be repeatedly run over the same data, and tested for desirable results. I'll file that now, so that I don't forget again... |
Hi, |
I love it! Great idea 😄 I'll add that to the todos for the task.
I'm lucky that the city I live in (Bangkok) has a full mix of all transport types, so in a single day I can travel by bicycle, bus, underground train, above ground train, boat, motorbike, and even airplane (if I've got somewhere to fly to!). So I often record days in Arc App that include four or more different activity types. Although one thing that tends to make a lot of difference is variation in city density. How iOS deals with lack of GPS line of sight, lack of (or high availability of) wifi hotspots, etc, can have a big impact on how energy efficient location recording is and the accuracy of results (and sometimes in very counter intuitive ways). So while I can get a broad mix of building densities in my city, I can't exactly replicate the densities in European cities, or cities in the US, for example. Having recordings of "problem trips" in various cities would probably help a lot for debugging various mystery problems with location accuracy. |
Hi, thank you for your great work with SDK. I've tried to use pods from develop branch, however I got an error while updating pods.
|
Hi @EugeneGoloboyar. The error you're seeing there looks to me to be a CocoaPods error, due to you using an older version of CocoaPods than the Podfile was built for. There shouldn't be any problems (that I'm aware of) running the most recent stable release on Xcode 10. |
Thank you for fast reply! |
Hi @freeubi! That's odd, with the duplication. I recommend deleting your Pods folder and doing a fresh pod install. You will also need to switch to using the The This is the Podfile snippet I'm using for the Demo App in the timelines branch: pod 'LocoKit', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'timelines'
pod 'LocoKit/Timelines', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'timelines'
pod 'LocoKitCore', :git => 'https://github.com/sobri909/LocoKit.git', :branch => 'timelines' |
Thanks, i could build with the timelines branch :) |
@sobri909 Any update or ETA about the merge? I will need emulators soon :T |
@freeubi What tasks are you using the sim for? LocoKit can't sensibly be used in the sim, because it don't produce correct CLLocation objects, and can't produce Core Motion data. So even the most basic inputs aren't available. I'll eventually have another look at figuring out why the sim binaries aren't building. But I don't think lack of them should block any work, because all dev and testing work should be done on device. |
@sobri909 Im developing a tamagotchi - fitness tracker combo, so it will be great to use sims for the tamagotchi part. Thats like 70% of my app :/ |
@freeubi Looks cool! That makes sense then. In the meantime, it might be worth conditionally including the LocoKit imports by build configuration. For example I conditionally include AppSpector in my debug builds like this: pod 'AppSpectorSDK', :configurations => ['Debug', 'MeRelease'] And then in code like this: #if canImport(AppSpectorSDK)
import AppSpectorSDK
#endif #if canImport(AppSpectorSDK)
...
AppSpector.run(with: config)
...
#endif |
I've added it to my todos for tomorrow anyway, to have another look into it. Presumably it's just some build script change that's needed, to make Xcode 10 happy. Hopefully I can get it back to normal without too much fuss. |
@sobri909 Thanks! |
@freeubi I think I've done it. f65b00e Just doing a LocoKit Demo App fresh Turns out it wasn't an Xcode 10 problem after all, it was because I used to build LocoKitCore from a workspace, but at some stage I ditched the workspace and used the project file directly, because LocoKitCore doesn't have any dependencies so the workspace was pointless. But that meant the Archive post action script was pointing to the wrong thing (which no longer existed). In typical Xcode fashion, the error messages were completely unrelated to the actual problem, and sent me on a wild goose chase, until I finally spotted the mismatch in the xcodebuild call myself. Heh. |
Ok, confirmed it's working properly on device, and on sim. The new LocoKitCore binary is good to go. Aside: I want to remove the required dependency on LocoKitCore eventually. Ideally it should only be necessary for use of LocoKitService things (eg modal fetches from the server, push wakeup call requests), and not be necessary if the app isn't using any LocoKitService. But there's still a few small required chunks of LocoKit hidden away in LocoKitCore (Kalman filters and real time moving/stationary detection being the main two), which I haven't had time to open source yet. Hopefully soon! |
Thanks, i will check it out tonight :) |
works like a charm! |
Hello,
can you please make a cocoapod version that can imported in xCode10 and swift 4.2?
Thanks :)
The text was updated successfully, but these errors were encountered: