Posts

Post not yet marked as solved
1 Replies
Progress! I hacked the BF code (in my local repo) and now I can connect to my Muse headset and distribute my app to TestFlight via App Store Connect! I changed line #42 in ble_lib_board.cpp to read: std::string lib_name = "../libsimpleble-c.dylib.framework/libsimpleble-c.dylib"; According the man page for dlopen(), a codesigned app with entitlements (which means any iOS app uploaded to the App Store) must use full paths for its dylibs. So my hack gives us a full path, but relative to the location of the calling binary, in this case libBoardController.dylib. According to an error message I received recently from App Store Connect, all frameworks must be located under /Frameworks, so that at least gives us a basis for forming the full paths. According to the same man page, dlopen() should also use @rpath, which is built into the calling dylib. That would be I think the optimal solution, so I will play with that next.
Post not yet marked as solved
1 Replies
OK I'm dumb. The Resnet50 model from the Apple website is not updatable. I think the solution is to use coremltools to convert a PyTorch model into CoreML, and make it updatable in the process, perhaps a la https://coremltools.readme.io/docs/updatable-neural-network-classifier-on-mnist-dataset#define-make_updatable.
Post not yet marked as solved
8 Replies
Post not yet marked as solved
2 Replies
It was an entitlements issue, not a Package issue. To fix it I had to disable App Sandbox via the Entitlements File. I had tried to enable the USB entitlement via the App Sandbox settings, but that did not help. What other entitlements do I need in order to open the serial port in read/write mode?
Post not yet marked as solved
14 Replies
I am getting the same compiler error using Xcode 13.2.1. The offending line of code is the NavigationLink, located at the bottom of the following, minimal reproducible sample. If I comment out that one line, the error goes away and the compile is almost instantaneous. Any suggestions? I've already tried using Strings instead of Ints for the tag/selection parameters. Same error. import SwiftUI import Foundation enum MarkerType: Double {   case unlabeled = -99   case end = -4   case start = -3   case stop = -2   case blank = -1   case image = 1 } class LabeledImage {   let image: Image   let marker: Double   var appeared = false       init(image: Image, marker: Double) {     self.image = image     self.marker = marker   } } struct SlideShow {   private let maxImages: Int = 10000   var images = [LabeledImage]()   var labels = [String]()   var totalImages: Int { return self.images.count }   private var fromFolder: URL       init(fromURL: URL = Bundle.main.bundleURL.appendingPathComponent("Contents/Resources/DefaultImages")) {     self.fromFolder = fromURL   } } class AppState: ObservableObject {   static var docDir: URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!   @Published var isMainMenuActive = false   @Published var loadFolder: URL = Bundle.main.bundleURL.appendingPathComponent("Contents/Resources/DefaultImages")   @Published var intervalSeconds: Double = 0.6   var saveFolder = URL(fileURLWithPath: "BCILab", relativeTo: docDir)   var labels = [String]()   var totalImages: Int = 0   var saveIndex: Int = 0 } struct minsample: View {   @StateObject private var appState = AppState()   @State private var slideshow = SlideShow()   @State private var selection: Int = 0       private func insertAppears(_ marker: Double) {     let nmarker = marker + 100.0   }       var body: some View {     NavigationView {       ForEach(0..<slideshow.images.count-1, id: \.self) { i in         let thisImage = slideshow.images[i].image           .resizable()           .aspectRatio(contentMode: .fit)           .onAppear(perform: { insertAppears(slideshow.images[i].marker) })         let nextImage = slideshow.images[i+1].image           .resizable()           .aspectRatio(contentMode: .fit)           .onAppear(perform: { insertAppears(slideshow.images[i+1].marker) })         NavigationLink(destination: nextImage, tag: i, selection: self.$selection) { thisImage }       }     }   } }
Post marked as solved
2 Replies
The same is happening with my code: onAppear() does not fire when the view on which it is called is nested too deeply. For example, if the body chain is ContentView->ViewController->MyView->Image, and the onAppear() is called on Image within the body of MyView, then it will not fire. However if Image is instead referenced within the body of ViewController, as a parameter to MyView, then onAppear will fire.