Skip to content

Try? thread exception issue with XCode 14.3 and Release #136

@gali8

Description

@gali8

I found an issue with XCode 14.3 on iOS when the build configuration (in schema) or archive are in Release.
No issues on XCode 14.2 or Debug.

Look the example below.

fileProfile and folderDevice are with "try?". Both are nil because both not exist.
the do/catch doesn't throws an exception instead a thread exception into the AppDelegate appears.

			let filePathProfile = Const.LOCAL_PATH_PROFILE // is /var/..../file.jpg
			let filePathDevice = Const.LOCAL_PATH_DEVICES_ROOT // is /var/..../folder
			
			let fileProfile = try? File(path: filePathProfile)
			let folderDevice = try? Folder(path: filePathDevice)
			
			do {
				try fileProfile?.delete()
				try folderDevice?.delete()
			}
			catch {
				debugPrint("\(error.localizedDescription)")
			}

The issue not appear and the exception LocationErrorReason.emptyFilePath is correctly thrown if:

  • try? is replaced with try
  • ?.delete() is replaced with .delete()
  • the two "let..." rows are moved into the do/catch
			let filePathProfile = Const.LOCAL_PATH_PROFILE // is /var/..../file.jpg
			let filePathDevice = Const.LOCAL_PATH_DEVICES_ROOT // is /var/..../folder
						
			do {
				let fileProfile = try File(path: filePathProfile)
				let folderDevice = try Folder(path: filePathDevice)
				
				try fileProfile.delete()
				try folderDevice.delete()
			}
			catch {
				debugPrint("\(error.localizedDescription)")
			}

I don't know if the issue is caused by File, Folder or both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions