Post

Replies

Boosts

Views

Activity

Issue with APN entitlement on iOS - Xcode 15
I have been pulling out my hair the past day over this. I am adding push / remote notifications (using FCM) and running into an issue with the APN entitlement not being added to provisioning profile - using automatic signing. Now I am somewhat of a new / hobbyist developer but I'm sure I've covered all the bases: Have added (and removed and re-added) the capability in Xcode. Created (and recreated) the APN key in the developer portal (combined with Sign in with Apple) AppDelegate is fine FCM returns a device key without issue. Cleaned build folder and rebuilt app Despite this I am still getting "10.18.0 [FirebaseMessaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid *aps-environment" entitlement string found for application" error. Include is a screen capture of the automatically generated profile which seems to illustrate the issue. Any and all advice is greatly appreciated ;)
3
0
2.5k
Dec ’23
SwiftUI responding to MKMapView Annotation callout taps
I have a basic SwiftUI app that uses an MKMapView via UIView Representable to display a range of places around the world (as annotations with Callouts using UIButton(type: .detailDisclosure)) Question is how can I detect when the user taps the detailDisclosure button and act on this in SwiftUI? I've had a search around the web but nothing has helped me nail a solution to this. Any pointers / suggestions greatly appreciated.
0
0
323
Feb ’22
swiftUI Picker closes automatically
I have a simple picker control being used to make a selection ( using SegmentedPickerStyle() ) however when used it automatically closes after a few seconds without the user being able to make a selection. I can't seem to see any reason why this is happening. Using Xcode 13 beta and ios15 Any thoughts ... ? Code for the picker control below                 Picker("Category:", selection: $selectedCategory) {                     ForEach(modelData.categories) { category in                     HStack {                         FAText(iconName: category.image, size: 12)                         Text(category.name)                     }                     }                 }                     Picker(selection: $selectedTaskPriorityIndex, label: Text("")) {                         ForEach(0 ..< taskPriority.count) {                             Image(systemName: "\(self.taskPriority[$0])")                         }                     }                         .pickerStyle(SegmentedPickerStyle())
2
0
484
Sep ’21
SwiftUI NavigationView adds (extra) blank space on top
I'm working on a simple app (new to SwiftUI) and having some issues with the NavigationView element. I have added a NavigationView to my top-level view but this creates a block of blank space above the view that I can't seem to remove. If I take out the NavigationView the rest of the views display as expected. I have tried removing the navigation bar Title modifiers from deeper in the app but that also hasn't had any effect. I'm at a bit of a loss as to what is going on here ... have I made this too complicated for my own good? (images to illustrate the results) Code for the view with the issue.       var body: some View {     NavigationView {       VStack{         todayView()         categoryList()         .padding(5)         Spacer()       }     }     .navigationBarTitle("")     .navigationBarHidden(true)   } } initial navigationLinks are in the categoriesList (Red) which lead to a list of items also with navigationLinks (code below)   @EnvironmentObject var modelData: ModelData       @State private var showHotListOnly = false       var filteredHotTasks: [Task] {     modelData.tasks.filter { task in       (!showHotListOnly || task.isHotList)     }   }       var body: some View {     //NavigationView {       List {       ForEach(filteredHotTasks) { task in         NavigationLink(destination: TaskDetail(task: task)) {           TaskRow(task: task)         }       }     }       .navigationTitle(showHotListOnly ? "Hot List" : "Tasks")       .navigationBarTitleDisplayMode(.inline)       .navigationBarItems(trailing:                   Button (action: {                     showHotListOnly.toggle()                   }) {                     Image(systemName: showHotListOnly ? "flame.fill" : "flame")                     .foregroundColor(showHotListOnly ? Color.orange : Color.gray)                   }                           )   //} } Any and all help greatly appreciated! Especially before I go bald from frustration.
1
0
4.4k
Jun ’21
SwiftUI tutorial : complex ui
Hi team, I’m working (slowly 😂) through the SwiftUI tutorial (creating a landmarks app) but have run into a bug I can’t figure out. I modified the app to retrieve its json data from a remote web server which has worked fine right up to adding the featured section where it creates an index out of bounds error. it seems like the features array isn’t getting populated but can’t see how to resolve it. any ideas? import Foundation import Combine import SwiftUI class ModelData: ObservableObject { @Published var landmarks: [Landmark] = [] var cancellationToken: AnyCancellable? init(){ getLocations() } var categories: [String: [Landmark]] { Dictionary( grouping: landmarks, by: { $0.category.rawValue } ) } var features: [Landmark] { landmarks.filter { $0.isFeatured } } } extension ModelData { func getLocations() { let url = "https://overseer.cyou/heritage/theList.php?token=" + randomString(length: 6) cancellationToken = apiRequest.request(url)? .mapError({ (error) - Error in return error }) .sink(receiveCompletion: { _ in }, receiveValue: { self.landmarks = $0 }) } func randomString(length: Int) - String { let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" return String((0..length).map{ _ in letters.randomElement()! }) } } struct apiRequest { static func request(_ path: String) - AnyPublisher[Landmark], Error? { guard let url = URL(string: path) else { return nil } let request = URLRequest(url: url) return apiCall.run(request) .map(\.value) .eraseToAnyPublisher() } } struct apiCall { struct ResponseT { let value: T let response: URLResponse } static func runT: Decodable(_ request: URLRequest) - AnyPublisherResponseT, Error { return URLSession.shared .dataTaskPublisher(for: request) .tryMap { result - ResponseT in let value = try JSONDecoder().decode(T.self, from: result.data) print(result.response) print(value) return Response(value: value, response: result.response) } .receive(on: DispatchQueue.main) .eraseToAnyPublisher() } }
0
0
303
Feb ’21
SwiftUI Landmarks tutorial
Hi team, I'm very new to SwiftUI development and have been plugging through the tutorial here - https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation Now I want to try switching from a local JSON file to a remote server JSON response. I've looked over using URLRequest but have been running into various errors. Can someone share how to go about switching the load method from local to remote, in beginner's terms?
1
0
364
Feb ’21
Learn to code 1 issue
Hi team, I’m new to swift - just getting started - and as such have been working through swift playgrounds on iPad however at the final exercise “ roll left, roll right” I’m having an issue escaping my while loop. This is my current code: while !(isBlocked &&  isBlockedLeft &&  isBlockedRight) {     moveForward()     if isBlocked && isBlockedLeft {         turnRight()     } else if isBlocked {         turnLeft()     }     if isOnGem {         collectGem()     } else if isOnClosedSwitch {         toggleSwitch()     } } problem being that when Byte reaches the end of the maze and is blocked front, left, and right the code doesn’t exit as (I believe) it should but rather byte turns and loops the maze again. what am I missing?
1
0
732
Aug ’20
Aspiring developer - swift playground
Hi all, I’m moving to swift from developing with PHP and JavaScript and as an intro have been going through the (quite fun) swift playground lessons. The last lesson - Roll Left Roll Right in learn to code 1 isn’t cooperating with me or I’m missing something obvious. at the end of the ‘maze’ when byte is blocked I’m having an issue getting the code to exit my while loop. Code is as follows: while !(isBlocked &&  isBlockedLeft &&  isBlockedRight) {     moveForward()     if isBlocked && isBlockedLeft {         turnRight()     } else if isBlocked {         turnLeft()     }     if isOnGem {         collectGem()     } else if isOnClosedSwitch {         toggleSwitch()     }     } Any pointers?
1
0
585
Aug ’20