Posts

Post not yet marked as solved
3 Replies
4.4k Views
I'm going insane over this, I'm using Xcode 13 beta 6 on the M1 MacBook Air. Every time I pick an image, I receive this error message. At this point I don't know what I can do because the message is so vague. Please help me.     @Binding var image: UIImage          func makeUIViewController(context: Context) -> UIImagePickerController {         let imagePicker = UIImagePickerController()         imagePicker.delegate = context.coordinator         return imagePicker     }          func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {              }          func makeCoordinator() -> Coordinator {         Coordinator(parent: self)     }          final class Coordinator: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {                   var parent: PhotoPicker                  init(parent: PhotoPicker){             self.parent = parent         }                  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {             if let image = info[.originalImage] as? UIImage {                 parent.image = image             }else{                              }             picker.dismiss(animated: true, completion: nil)         }     } }          @State private var isPresented: Bool = false     @State private var avatarImage = UIImage(systemName: "person") ?? UIImage()          var body: some View {         VStack {             Image(uiImage: avatarImage)                 .resizable()                 .scaledToFill()                 .frame(width: 150, height: 150)                 .clipShape(Circle())                 .padding()                 .onTapGesture {                     isPresented = true                 }                          Spacer()         }         .navigationTitle("Profile")         .sheet(isPresented: $isPresented) {             PhotoPicker(image: $avatarImage)         }     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
486 Views
How would I get around creating a follow/feed system. I can work this out using Firebase, but since I'm new to CloudKit I can't wrap my head around the database structure. Any help would be greatly appreciated. :)
Posted Last updated
.
Post not yet marked as solved
0 Replies
636 Views
I receive this error *** -[NSURL URLByAppendingPathExtension:]: component, components, or pathExtension cannot be nil. ( 0   CoreFoundation                      0x000000010d5f7fba __exceptionPreprocess + 242 1   libobjc.A.dylib                     0x000000010f159ff5 objc_exception_throw + 48 2   Foundation                          0x000000010ece639e -[NSURL(NSURLPathUtilities) URLByDeletingPathExtension] + 0 3   PhotosUI                            0x0000000139be495f -[PUPhotoPickerExtensionHostContext _UIImagePickerControllerInfoDictionaryFromPhotoPickerInfoDictionary:] + 2203 4   PhotosUI                            0x0000000139be3f36 -[PUPhotoPickerExtensionHostContext didSelectMediaWithInfoDictionary:] + 34 5   Foundation                          0x000000010edaebd7 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S1__ + 10 6   Foundation                          0x000000010edad90f -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] + 2268 7   Foundation                          0x000000010edaef06 message_handler + 206 8   libxpc.dylib                        0x0000000117233cf8 _xpc_connection_call_event_handler + 56 9   libxpc.dylib                        0x000000011723407c _xpc_connection_mach_event + 891 10  libdispatch.dylib                   0x0000000116e577ee _dispatch_client_callout4 + 9 11  libdispatch.dylib                   0x0000000116e7180a _dispatch_mach_msg_invoke + 550 12  libdispatch.dylib                   0x0000000116e5ddb1 _dispatch_lane_serial_drain + 307 13  libdispatch.dylib                   0x0000000116e726c8 _dispatch_mach_invoke + 555 14  libdispatch.dylib                   0x0000000116e5ddb1 _dispatch_lane_serial_drain + 307 15  libdispatch.dylib                   0x0000000116e5ec9d _dispatch_lane_invoke + 490 16  libdispatch.dylib                   0x0000000116e6aa7a _dispatch_workloop_worker_thread + 872 17  libsystem_pthread.dylib             0x000000011732a45d _pthread_wqthread + 314 18  libsystem_pthread.dylib             0x000000011732942f start_wqthread + 15 ) struct ImagePicker: UIViewControllerRepresentable {          @Binding var uiImage: UIImage?          func makeUIViewController(context: Context) -> UIImagePickerController {         let imagePicker = UIImagePickerController()         imagePicker.allowsEditing = true         imagePicker.delegate = context.coordinator         return imagePicker     }          func makeCoordinator() -> Coordinator {         Coordinator(parent: self)     }          func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }          class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {                  var parent: ImagePicker                  init(parent: ImagePicker){             self.parent = parent         }                  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {             if let image = info[.editedImage] as? UIImage {                 parent.uiImage = image             }             picker.dismiss(animated: true, completion: nil)         }     } } A few people have said this is because of the Mac M1 chip, is there a nice fix for this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
940 Views
Hello all, I'm Connor and I'm an aspiring developer. I have an alright understanding of SwiftUI, but it's not perfect and by no means complete. I came from knowing Java, which provides the concept of threads. Which enables the system to almost behave independently of current processes. My program is basically trying to monitor locations, similar to Apples Region Monitoring system on Swift, but add more functionality, including setting the distance to be notified. I'm wondering whether more experienced developers than myself could lead me in the right direction. Ideas that I had so far are: Save real-time location onto Firebase database, then every update of the database checks that location and how close it is to the regions I want to monitor. Find out if threading is a thing and use that. Any suggestions you all have. I'm using CoreLocation to monitor the users location data and GeoQuery to identify landmarks near the user. Any suggestions for how I should continue would be really appreciative. Thank you, Connor TL;DR: How do I re-develop apples region monitoring system, but add more functionality?
Posted Last updated
.