LoopKit / CGMBLEKit

Make your G5/G6 data truly mobile.
MIT License
140 stars 150 forks source link

Can this run on iOS 14? #165

Open snackattas opened 2 years ago

snackattas commented 2 years ago

Does CGMBLEKit work for iOS 14? I am a willing and able beta-tester if y'all want me to try it! I'm giving it a go on my own right now, and was able to build it by doing some things:

After it builds successfully, I now get this error when it runs on my iphone after clicking the play button:

dyld[4787]: Library not loaded: @rpath/SwiftCharts.framework/SwiftCharts
  Referenced from: /private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/LoopKitUI
  Reason: tried: '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/System/Library/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file)
Library not loaded: @rpath/SwiftCharts.framework/SwiftCharts
  Referenced from: /private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/LoopKitUI
  Reason: tried: '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4A
(lldb) 

When it builds and opens, its just a blank screen

CAMOBAP commented 2 years ago

@snackattas I also have tested with 14.1 but didn't face with such an issue. Generally Library not loaded: @rpath/XXX.framework/XXX issue means that framework wasn't copied to result app bundle

Can you confirm that Build phases has "Copy framework" step and looks like this?

Screen Shot 2022-01-02 at 12 04 29 AM
snackattas commented 2 years ago

I checked, it matches yours. Not sure what the issue is then.

I deleted my CGMLEKit directory and cloned a new one, to try again, with these steps, without editing ANY of the code in the CGMBLEKit like before, except for Scripts/carthage.sh My steps:

  1. Go into ResetTransmitter target, change the loopkit thing to a unique string com.snackattas.ResetTransmitter
  2. Click into Signing & Capabilities, assign to myself (no signing issues after that)
  3. Updated the Scripts/carthage.sh file to this (ably/ably-cocoa@7506465)
  4. run ./Scripts/carthage.sh update --platform iOS, seems successful
  5. run ./Scripts/carthage.sh build --platform iOS, seems successful
  6. Close and re-open xcode, for superstition (it was on in the foreground during the running of these things, not sure if that matters)
  7. Toggle the ResetTransmitter app, the part of xcode that's on the top, to my plugged in iPhone running iOS 14.1, so it says ResetTransmitter > <my iphone>
  8. Pressed the play button

When doing that I get the SwiftCompile error.

screenshot_2022-01-01 17 31 19_ZV40Qq

Then, instead of doing the

So, what exactly am I supposed to change to make everything 14.1 compatible? Were these places actually correct? dev/CGMBLEKit.xcodeproj/project.pbxproj#L1750

Then, instead of editing the code like I did before, I changed this dropdown. screenshot_2022-01-01 17 36 21_D5LVRz

And then the app built, BUT, got the same Library not loaded error

CAMOBAP commented 2 years ago

So, what exactly am I supposed to change to make everything 14.1 compatible? Were these places actually correct? dev/CGMBLEKit.xcodeproj/project.pbxproj#L1750

Yep, but actually both (debug and release):

You can do this from Project settings, just select App target and search for "deployment target"

snackattas commented 2 years ago

Thanks for the response! I'll do it from project settings then!

After you do that step, do you have to rerun the Script/carthage build command, just curious

Also, just realizing now, I am running iOS 15.1 on my phone, not 14.1 I'm so sorry I totally got my own iOS confused 🤦 . So next experiment will be doing the steps with 15.1 set as target

CAMOBAP commented 2 years ago

"Deployment target" == Minimal supported iOS version

The issue in the comment https://github.com/LoopKit/CGMBLEKit/issues/165#issuecomment-1003636172 was about CGMLEKit's deployment target being higher than ResetTransmitter's deployment target

The general rule here is: deployment target of framework cannot be higher then deployment target of the app which uses those frameworks