I’ve examined my app on a number of simulators and an iPhone 15 working iOS 17.5.1. The app runs wonderful for me. However after I submit my app to the App Retailer, it crashes for the testers. They ran the app on an iPhone 13 mini and an iPad air, each working iOS 17.5.1.
The crash logs they supplied do not shed a lot mild on the issue. I’ve searched associated posts to those traces:
"sort":"EXC_BREAKPOINT","sign":"SIGTRAP"
Hint/BPT entice: 5
The foremost contributor to most of these exceptions is commonly pressured unwrapped optionals. I’ve no optionals within the code in query.
The testers reported the identical factor on every event, that the app crashed once they had been clicking across the completely different residents (profiles) within the app. They login, navigate to the residents checklist display, click on on the primary resident, and the app crashes.
I used to be beforehand utilizing a singleton I assumed may need been inflicting the issue and I refactored it, however this system crashed for all of them the identical. It doesn’t matter what I do I can not get the app to crash.
Here is the residents checklist (ResidentTableView):
import SwiftUI
struct ResidentTableView: View {
@Binding var controller: ResidentController
@State non-public var isPresentingConfirm: Bool = false
@State non-public var residentToDelete: Resident?
@State var resident = Resident(id: UUID(), firstName: "", middleName: "", lastName: "", phoneNumber: "", e-mail: "", dob: "", handle: "", rentAmount: 0, pastDueRentOwed: 0, isPastDue: false, isRetiredClient: false, monthlyReminderScheduled: false, home: "Lion's Den", roomNumber: 0, bedNumber: 0, housePin: 0, moveInDate: Date().formatted(date: .numeric, time: .omitted))
var physique: some View {
VStack {
Textual content("")
.navigationTitle("Residents")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
NavigationLink {
AddEditResidentView(controller: controller, resident: $resident)
} label: {
Textual content("+")
.font(.largeTitle)
}
}
}
Checklist {
ForEach(controller.residents.sorted { $0.lastName < $1.lastName }) { resident in
ResidentCellView(resident: resident, controller: controller)
.swipeActions {
Button(position: .damaging) {
residentToDelete = resident
isPresentingConfirm = true
} label: {
Label("Delete", systemImage: "trash")
}
}
}
}
.confirmationDialog("Are you positive you need to delete this resident?", isPresented: $isPresentingConfirm, titleVisibility: .seen) {
Button("Delete", position: .damaging) {
if let residentToDelete = residentToDelete,
let index = controller.residents.firstIndex(the place: { $0.id == residentToDelete.id }) {
Job {
do {
attempt await NetworkController.shared.deleteResident(resident: residentToDelete)
controller.residents.take away(at: index)
} catch {
// Deal with error (e.g., present an alert)
print("Error deleting resident: (error)")
}
}
}
}
Button("Cancel", position: .cancel) {}
}
}
}
}
Every merchandise within the checklist exhibits a snippet:
import SwiftUI
struct ResidentCellView: View {
@State var resident: Resident
var controller: ResidentController
var physique: some View {
NavigationLink(vacation spot: ResidentDetailView(controller: controller, resident: resident)
) {
VStack(alignment: .main) {
Textual content("(resident.firstName)" + " " + resident.lastName)
.font(.headline)
//.background(Coloration.crimson)
Textual content(String(format: "Complete Lease Owed: $%.02f", resident.pastDueRentOwed + resident.rentAmount))
//.background(Coloration.inexperienced)
Textual content("Cellphone Quantity: (resident.phoneNumber.formatPhoneNumber())")
.textSelection(.enabled)
}
}
}
}
Here is ResidentDetailView, regardless that the testers by no means even made it that far:
import SwiftUI
struct ResidentDetailView: View {
@Setting(.presentationMode) var presentationMode: Binding<PresentationMode>
var controller: ResidentController
@State var resident: Resident
var physique: some View {
Textual content("")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
NavigationLink("Edit") {
AddEditResidentView(controller: controller, resident: $resident, edit: true)
}
}
}
VStack(alignment: .main) {
HStack {
Textual content("Title: ")
Textual content(resident.firstName + " " + resident.lastName)
}
HStack {
Textual content("Cellphone Quantity: ")
Textual content(resident.phoneNumber.formatPhoneNumber())
.textSelection(.enabled)
}
HStack {
Textual content("E mail: ")
Textual content(resident.e-mail)
}
HStack {
Textual content("Home: ")
Textual content(resident.home)
}
HStack {
Textual content("Date Of Bith: ")
Textual content(resident.dob)
}
HStack {
Textual content("Lease Quantity: ")
Textual content(String(format: "$%.02f", resident.rentAmount))
}
HStack {
Textual content("Lease Due Date: ")
Textual content(resident.rentDueDate)
}
HStack {
Textual content("Previous Due: ")
Textual content("(resident.isPastDue)")
}
if resident.isPastDue {
HStack {
Textual content("Overdue Stability: ")
Textual content(String(format: "$%.02f", resident.pastDueRentOwed))
}
}
HStack {
Textual content("Subsequent Textual content Reminder: ")
Textual content(resident.rentAlertDate.formatted(date: .numeric, time: .commonplace))
}
HStack {
Textual content("Textual content Reminder Scheduled: ")
Textual content("(resident.monthlyReminderScheduled)")
}
HStack {
Textual content("Transfer-In Date: ")
Textual content("(resident.moveInDate)")
}
HStack {
Textual content("Deal with: ")
Textual content("(resident.handle)")
}
HStack {
Textual content("Room Quantity: ")
Textual content("(resident.roomNumber)")
}
HStack {
Textual content("Mattress Quantity: ")
Textual content("(resident.bedNumber)")
}
HStack {
Textual content("Pin Quantity: ")
Textual content(String(resident.housePin))
}
Spacer()
DeleteButton(presentationMode: _presentationMode, resident: $resident, controller: controller)
.padding(.backside)
}
.padding()
}
}
Resident mannequin:
struct Resident: Codable, Identifiable, Equatable {
var id: UUID
var firstName: String
var middleName: String
var lastName: String
var phoneNumber: String
var e-mail: String
var dob: String
var handle: String
var rentAmount: Double
var pastDueRentOwed: Double
var isPastDue: Bool
var isRetiredClient = false
var monthlyReminderScheduled: Bool
var home: String
var roomNumber: Int
var bedNumber: Int
var housePin: Int
var moveInDate: String
}
ResidentViewModel (Controller)
import Basis
@Observable class ResidentController {
var residents: [Resident] = []
var pastDueResidents: [Resident] = []
var kickedOutResidents: [Resident] = []
var sampleResidents: [Resident] = [Resident(id: UUID(), firstName: "Bob", middleName: "Bobbert", lastName: "Bobbington", phoneNumber: "909999999", email: "[email protected]", dob: "6/10/1995", handle: "123 Vist Lane, Wilmington, VA 90604", rentAmount: 500, pastDueRentOwed: 200, isPastDue: true, isRetiredClient: false, monthlyReminderScheduled: false, home: "Lion's Den", roomNumber: 1, bedNumber: 2, housePin: 9455, moveInDate: "6/2/2023")]
func loadInitialUserList() -> [Resident] {
if residents.isEmpty {
residents = Resident.sampleResidents()
}
return residents
}
func addResident(_ resident: Resident) {
residents.append(resident)
}
func replace(_ updatedResident: Resident, at index: Int) {
guard index >= 0 && index < residents.rely else { return }
residents[index] = updatedResident
}
func take away(at index: Int) {
residents.take away(at: index)
}
func getPastDueAccounts() {
for index in 0 ..< residents.rely {
if residents[index].isPastDue {
pastDueResidents.append(residents[index])
}
}
}
}
Here is an besides of the crashlog (I can not match the entire thing right here):
{"app_name":"Constructing Beginnings Admin","timestamp":"2024-06-10 18:56:39.00 -0700","app_version":"1.0","slice_uuid":"562363b4-39b9-3aff-a58b-55f99c558c4b","adam_id":"6498866367","build_version":"9","platform":2,"bundleID":"SwiftStudent.TextAlert","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"iPhone OS 17.5.1 (21F90)","roots_installed":0,"identify":"Constructing Beginnings Admin","incident_id":"C284D55E-046A-4A8D-9544-AB06381CBC0C"}
{
"uptime" : 10000,
"procRole" : "Foreground",
"model" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "iPad13,16",
"coalitionID" : 890,
"osVersion" : {
"isEmbedded" : true,
"practice" : "iPhone OS 17.5.1",
"releaseType" : "Person",
"construct" : "21F90"
},
"captureTime" : "2024-06-10 18:56:38.8952 -0700",
"codeSigningMonitor" : 1,
"incident" : "C284D55E-046A-4A8D-9544-AB06381CBC0C",
"pid" : 946,
"cpuType" : "ARM-64",
"roots_installed" : 0,
"bug_type" : "309",
"procLaunch" : "2024-06-10 18:56:13.9356 -0700",
"procStartAbsTime" : 250528413074,
"procExitAbsTime" : 251127369378,
"procName" : "Constructing Beginnings Admin",
"procPath" : "/non-public/var/containers/Bundle/Utility/B4DBAB45-B3C4-402F-AEE3-739D0C2C35BC/Constructing Beginnings Admin.app/Constructing Beginnings Admin",
"bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"9","CFBundleIdentifier":"SwiftStudent.TextAlert","DTAppStoreToolsBuild":"15F31e"},
"storeInfo" : {"itemID":"6498866367","deviceIdentifierForVendor":"B5AB9B12-F84C-49A8-BFBC-586FD0418E37","thirdParty":true,"softwareVersionExternalIdentifier":"865280664"},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "SwiftStudent.TextAlert",
"crashReporterKey" : "10d7b91b93e6719b378603445e235dadbafa5b99",
"wasUnlockedSinceBoot" : 1,
"isLocked" : 0,
"codeSigningID" : "SwiftStudent.TextAlert",
"codeSigningTeamID" : "ZFY8845GGW",
"codeSigningFlags" : 570450689,
"codeSigningValidationCategory" : 4,
"codeSigningTrustLevel" : 7,
"instructionByteStream" : {"beforePC":"9E9EqfZXQ6n4X0Kp+mdBqfxvxqjAA1/WAQIAkCGACJHgAxSqqQ4AlA==","atPC":"IAAg1CAAINQgACDUIAAg1Pxvuqn6ZwGp+F8CqfZXA6n0TwSp/XsFqQ=="},
"exception" : {"codes":"0x0000000000000001, 0x0000000100f31d0c","rawCodes":[1,4310899980],"sort":"EXC_BREAKPOINT","sign":"SIGTRAP"},
"termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Hint/BPT entice: 5","byProc":"exc handler","byPid":946},
"os_fault" : {"course of":"Constructing Beginnings Admin"},
"faultingThread" : 0,