Post

Replies

Boosts

Views

Activity

Reply to How to create a variable that can be used or changed in all swift files
Welcome to the forum. as @ssmith_c has told, your question is hard to understand. What is your environment ? Playground ? app development ? SwiftUI or UIKit… What is home ? Are settings the settings of your app in iOS settings ? If so, you have to create a settings bundle. See complete details here: https://makeapppie.com/2016/03/14/using-settings-bundles-with-swift/ So, please explain so that we can better help.
Jul ’24
Reply to A new message 'Answered by forumsContributor in' with a link to nowhere
While investigating, here is another bug I noticed: I received an email notifying that my answer was recommended by Apple. Going to the thread https://developer.apple.com/forums//thread/758452?answerId=793464022#793464022, I noticed that the correct answer was, logically, the DTS's answer, not mine which was just for asking for more information. Filed a bug report: FB14172207
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
as soon as I try it out with other matrices, the function crashes with this error: 'Matrix is structurally singular'. Could you show examples of Matrix that cause crash ? It would be surprising that any other matrix be singular. Unless it is not the original matrix but some derived one.   However, the other leastSquaresSolution-method that I initially wrote also returns zero's Did you post this method, to see the difference ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
The article does not give complete code, so you probably had to complete for your own code. If I understood it correctly, the SparseSolve function changes x, which in turn changes xPtr and xValues. x is passed as a parameter (and const) to the function, so it is not modified by SparseSolve. To be clear, I did not analyse nor understand the details of how SparseSolve works, but I looked at the doc for SparseSolve (however I did not find one that returns a status), and it seems to be a bit different: let xValues = [Double](unsafeUninitializedCapacity: n) { buffer, count in bValues.withUnsafeMutableBufferPointer { bPtr in let b = DenseVector_Double(count: 3, data: bPtr.baseAddress!) let x = DenseVector_Double(count: 3, data: buffer.baseAddress!) SparseSolve(factorization, b, x) count = n } } On return, xValues contains the values [1.0, 2.0, 3.0]. Here, xValues is changed in the completion handler. Could you try to replicate this ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
Much better with the comments. However, I still do not catch where xValues is modified (initialised as zeros). It should be in this part, correct ? bValues.withUnsafeMutableBufferPointer { bPtr in xValues.withUnsafeMutableBufferPointer { xPtr in // Construct the matrices B and x in Ax = B let b = DenseVector_Double( count: Int32(B.count), data: bPtr.baseAddress! ) let x = DenseVector_Double( count: Int32(A.transpose().count), data: xPtr.baseAddress! ) // Try to find X with SparseSolve (this is where it seems to go wrong) let status = SparseSolve(SparseLSMR(), a, b, x, SparsePreconditionerDiagScaling) if status != SparseIterativeConverged { fatalError("Failed to converge. Returned with error \(status).") } } } through the change of xPtr. Correct ? But where is xPtr modified ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’24
Reply to BUG: **** YOU APPLE
**** I hope it is to hide a compliment… Otherwise it would be absolutely inappropriate, and not the best way to ask for help.
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
Welcome to the forum. This code may be readable for you, but without any comment, it is a headache, at least for me, to really understand … So I may miss something in your code. If I understand what you are doing in static func leastSquaresSolution(A: [[Double]], B: [Double]) -> [Double] { you are computing and return xValues This should be done by manipulating xPtr. Correct ? xValues.withUnsafeMutableBufferPointer { xPtr in xValues is initialised with 0.0 values. Where do you update xPtr, which would modify xValues before you return it ?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Reply to Xcode Says " 'App' is only available in macOS 11.0 or newer "
What about the package itself. Are the minimum deployment you show (macOS 14.0) for this package ? Is it a package you developed or one you imported ?
Replies
Boosts
Views
Activity
Jul ’24
Reply to How to create a variable that can be used or changed in all swift files
Welcome to the forum. as @ssmith_c has told, your question is hard to understand. What is your environment ? Playground ? app development ? SwiftUI or UIKit… What is home ? Are settings the settings of your app in iOS settings ? If so, you have to create a settings bundle. See complete details here: https://makeapppie.com/2016/03/14/using-settings-bundles-with-swift/ So, please explain so that we can better help.
Replies
Boosts
Views
Activity
Jul ’24
Reply to App screenshots - PNG or JPG?
I always use png. I think it is safer (note that's the format generated by simulator screen shots).
Replies
Boosts
Views
Activity
Jul ’24
Reply to A new message 'Answered by forumsContributor in' with a link to nowhere
While investigating, here is another bug I noticed: I received an email notifying that my answer was recommended by Apple. Going to the thread https://developer.apple.com/forums//thread/758452?answerId=793464022#793464022, I noticed that the correct answer was, logically, the DTS's answer, not mine which was just for asking for more information. Filed a bug report: FB14172207
Replies
Boosts
Views
Activity
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
as soon as I try it out with other matrices, the function crashes with this error: 'Matrix is structurally singular'. Could you show examples of Matrix that cause crash ? It would be surprising that any other matrix be singular. Unless it is not the original matrix but some derived one.   However, the other leastSquaresSolution-method that I initially wrote also returns zero's Did you post this method, to see the difference ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
The article does not give complete code, so you probably had to complete for your own code. If I understood it correctly, the SparseSolve function changes x, which in turn changes xPtr and xValues. x is passed as a parameter (and const) to the function, so it is not modified by SparseSolve. To be clear, I did not analyse nor understand the details of how SparseSolve works, but I looked at the doc for SparseSolve (however I did not find one that returns a status), and it seems to be a bit different: let xValues = [Double](unsafeUninitializedCapacity: n) { buffer, count in bValues.withUnsafeMutableBufferPointer { bPtr in let b = DenseVector_Double(count: 3, data: bPtr.baseAddress!) let x = DenseVector_Double(count: 3, data: buffer.baseAddress!) SparseSolve(factorization, b, x) count = n } } On return, xValues contains the values [1.0, 2.0, 3.0]. Here, xValues is changed in the completion handler. Could you try to replicate this ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
Much better with the comments. However, I still do not catch where xValues is modified (initialised as zeros). It should be in this part, correct ? bValues.withUnsafeMutableBufferPointer { bPtr in xValues.withUnsafeMutableBufferPointer { xPtr in // Construct the matrices B and x in Ax = B let b = DenseVector_Double( count: Int32(B.count), data: bPtr.baseAddress! ) let x = DenseVector_Double( count: Int32(A.transpose().count), data: xPtr.baseAddress! ) // Try to find X with SparseSolve (this is where it seems to go wrong) let status = SparseSolve(SparseLSMR(), a, b, x, SparsePreconditionerDiagScaling) if status != SparseIterativeConverged { fatalError("Failed to converge. Returned with error \(status).") } } } through the change of xPtr. Correct ? But where is xPtr modified ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to error code
Which API ? What is the code ? What is the exact and complete message ? Is it a warning or an error that stops compilation ?
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to BUG: **** YOU APPLE
**** I hope it is to hide a compliment… Otherwise it would be absolutely inappropriate, and not the best way to ask for help.
Replies
Boosts
Views
Activity
Jul ’24
Reply to Why did self change?
Impossible to say anything with so limited information. Please give details and the complete code you run. And explain where you observe the change.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Peculiar EXC_BAD_ACCESS, involving sparse matrices
Welcome to the forum. This code may be readable for you, but without any comment, it is a headache, at least for me, to really understand … So I may miss something in your code. If I understand what you are doing in static func leastSquaresSolution(A: [[Double]], B: [Double]) -> [Double] { you are computing and return xValues This should be done by manipulating xPtr. Correct ? xValues.withUnsafeMutableBufferPointer { xPtr in xValues is initialised with 0.0 values. Where do you update xPtr, which would modify xValues before you return it ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Just made DynamicLake Pro for macOS (DynamicIsland)
Forum is not for promoting app. It is for asking question about development.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Tiktok Live Hang on ios 18
Welcome to the developers forum. Your question is not about an app development. So it is not for this forum. You'd better file a bug report in Feedback assistant or ask on the app's forum.
Replies
Boosts
Views
Activity
Jun ’24
Reply to IOS 18.0 Beta - „Hidden“ Feature ‚Bug‘
Could you show with screenshots what you get and what you'd expect ? In any case, forum is not the right place to report bugs. Use Feedback Assistant instead.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Is there no way to support upside down orientation on newer iPhones?
You did not miss anything. Effectively, I don't think it is possible. Reason is that notch or Dynamic Island would not be compatible with the dismiss bar at the bottom. Don't forget to close your threads when done by tapping the correct answer button.
Topic: UI Frameworks SubTopic: General
Replies
Boosts
Views
Activity
Jun ’24