Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gali8 opened this issue May 10, 2023 · 0 comments
Open

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

gali8 opened this issue May 10, 2023 · 0 comments

Comments

@gali8
Copy link

gali8 commented May 10, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant