Post

Replies

Boosts

Views

Activity

Reply to ITMS-90809: Deprecated API Usage
Did you try the solution presented here (I think the important is the flag to add to the build): https ://devblogs.microsoft. com/xamarin/uiwebview-deprecation-xamarin-forms/ Go and see it to have screenshots as well. The solution only involves three steps:  Use the right versions of Xamarin.Forms and Xamarin.iOS.  Do you use Forms ≥ 4.5 and .Xamarin.iOS ≥ 13.10.0.17 Add a flag to the build configuration. (is it what you did with link all ?). Did you add the Additional mtouch arguments defined in the screen shot (--optimize=experimental-xforms-product-type)? Build and submit your app to the App Store On the Xamarin.Forms side we also had to make some changes to make all this work correctly. These new changes are part of Xamarin.Forms 4.5, including the pre-releases. Make sure that you are using the Forms 4.5 or newer NuGet package in your projects.  You also need to make sure that you are using Xamarin.iOS 13.10.0.17. You can check this from Visual Studio. This version of Xamarin.iOS is included with Visual Studio for Mac 8.4.1 and Visual Studio 16.4.3 and up.  With that in place, you can simply go to your iOS project, open the project properties and add this flag in the additional mtouch arguments field: --optimize=experimental-xforms-product-type this flag works together with the Linker Behavior set to SDK Only or All. If for any reason you see errors when setting the Linker Behavior to All, this is most likely a problem within the app code or a 3rd party library that is not linker safe. For more information on the linker, please refer to the docs. If that works, don't forget to mark the correct answer, it may help others.
May ’21
Reply to Why is this crashing?
A general comment first. You could streamline your code by replacing statement like if unlocked.contains("Summer") { } else { unlocked.append("Summer") } by if !unlocked.contains("Summer") { unlocked.append("Summer") } Which line do you get the crash exactly ? (code is slightly different from the snippet you present, so that makes it difficult to localise where this occurs); is it in didSelectRowAt ? Line 7, 10 or 16, 19 ? If that's here: i don't understand how you use names: rows in sections will be 0, 1, 2, restarting at zero in each section you call self.unlocked[indexPath.row] ; Could you test with a print the size of self.unlocked and the number of rows in section ? func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(indexPath.row) tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { let icon = self.unlocked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark } } else if indexPath.section == 1 { let icon = self.locked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark IconChange.pushBack = true self.navigationController?.popViewController(animated: true) } } } Yet another comment. Maintaining several arrays to keep track of what is in tableView is really a risky design (the crash is just an illustration). You'd better have a single dataSource, with attributes as locked: Bool instead of locked and unlocked arrays.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Why aren't Apple employees monitoring this forum? What gives?
Just my personal comment on this. I appreciate the way some, like Quinn -- BTW, the most active contributor by far on the forum --, contribute to the forum, with very precise and helpful answers when he feels that exchanges between developers are stuck in the sand. But I find it useful to keep this forum a developers forum, developers helping developers, sharing their experience and knowledge, and not to become a substitute for the Apple support channel. This being said, I regret that, when a problem is reported again and again and that no-one with in depth knowledge of the root causes jumps in.
May ’21
Reply to Why is this crashing?
So, add the print and tell what you get before crash: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(indexPath.row) print("unlocked:", self.unlocked.count, "locked:", self.locked.count) // -- add this tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { let icon = self.unlocked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark } } else if indexPath.section == 1 { let icon = self.locked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark IconChange.pushBack = true self.navigationController?.popViewController(animated: true) } } } My guess is that indexPath.row gets larger than the array size.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Why is this crashing?
Once an icon gets purchased, setIconPurchased gets set to true, and then if it equals true it does more actions. If so, why don't you launch the other action in the same func where you set setIconPurchased to true ? But the overall problem is that your code is too complex. One reason is that you store ate of cells in different arrays that you need to sync.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Fatal error: Index out of range. In for loop using an array.
You can also create the array with the right number of elements : let maxLevel:Int = 99 var randomSeq: [Int] = Array(repeating: 0, count: 99). // Array full of zero ; in playground, you can use maxLevel here Now, you can use your code Take care in your loop, array indexes start at zero: for i in 0...maxLevel-1 { randomSeq[i] = Int.random(in: 1...4) or for i in 0...randomSeq.count-1 { randomSeq[i] = Int.random(in: 1...4)
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
MKOverlay is a protocol. And type is effectively MKPolyline In the GitHub code, they note: // MKPointAnnotations and are not MKOverlays. var points: [MKAnnotation] { return _placemarks.compactMap{$0.point} } So, to get the points, instead of using         let overlays = self.kmlParser.overlays did you try using         let points = self.kmlParser.points (but that may be only the coordinates of the annotation, not your line).
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to How to declare a scope in code ?
There is not other method to declare the scope beside creating a new SwiftUI view file ? Your wording is confusing. You do not declare a scope, you declare something and depending where and how, that defines its visibility scope. Problem you had here was that the declaration was just missing, hence AdvancedSettingsView could not be found in the scope where you tried to use. Note that you can limit scope of visibility, with attributes as private, fileprivate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Cancel button not working?
In the storyboard, select the button for which you want to remove the action. Open the connection inspector on the right panel of Inspectors (last icon on the right in shape of a dot in a circle. You will find either an action or a sent event defined. Click on the small x to remove the connection. Do an option clean build folder to get fully rid of it.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to ITMS-90809: Deprecated API Usage
Did you try the solution presented here (I think the important is the flag to add to the build): https ://devblogs.microsoft. com/xamarin/uiwebview-deprecation-xamarin-forms/ Go and see it to have screenshots as well. The solution only involves three steps:  Use the right versions of Xamarin.Forms and Xamarin.iOS.  Do you use Forms ≥ 4.5 and .Xamarin.iOS ≥ 13.10.0.17 Add a flag to the build configuration. (is it what you did with link all ?). Did you add the Additional mtouch arguments defined in the screen shot (--optimize=experimental-xforms-product-type)? Build and submit your app to the App Store On the Xamarin.Forms side we also had to make some changes to make all this work correctly. These new changes are part of Xamarin.Forms 4.5, including the pre-releases. Make sure that you are using the Forms 4.5 or newer NuGet package in your projects.  You also need to make sure that you are using Xamarin.iOS 13.10.0.17. You can check this from Visual Studio. This version of Xamarin.iOS is included with Visual Studio for Mac 8.4.1 and Visual Studio 16.4.3 and up.  With that in place, you can simply go to your iOS project, open the project properties and add this flag in the additional mtouch arguments field: --optimize=experimental-xforms-product-type this flag works together with the Linker Behavior set to SDK Only or All. If for any reason you see errors when setting the Linker Behavior to All, this is most likely a problem within the app code or a 3rd party library that is not linker safe. For more information on the linker, please refer to the docs. If that works, don't forget to mark the correct answer, it may help others.
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
A general comment first. You could streamline your code by replacing statement like if unlocked.contains("Summer") { } else { unlocked.append("Summer") } by if !unlocked.contains("Summer") { unlocked.append("Summer") } Which line do you get the crash exactly ? (code is slightly different from the snippet you present, so that makes it difficult to localise where this occurs); is it in didSelectRowAt ? Line 7, 10 or 16, 19 ? If that's here: i don't understand how you use names: rows in sections will be 0, 1, 2, restarting at zero in each section you call self.unlocked[indexPath.row] ; Could you test with a print the size of self.unlocked and the number of rows in section ? func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(indexPath.row) tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { let icon = self.unlocked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark } } else if indexPath.section == 1 { let icon = self.locked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark IconChange.pushBack = true self.navigationController?.popViewController(animated: true) } } } Yet another comment. Maintaining several arrays to keep track of what is in tableView is really a risky design (the crash is just an illustration). You'd better have a single dataSource, with attributes as locked: Bool instead of locked and unlocked arrays.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why aren't Apple employees monitoring this forum? What gives?
Just my personal comment on this. I appreciate the way some, like Quinn -- BTW, the most active contributor by far on the forum --, contribute to the forum, with very precise and helpful answers when he feels that exchanges between developers are stuck in the sand. But I find it useful to keep this forum a developers forum, developers helping developers, sharing their experience and knowledge, and not to become a substitute for the Apple support channel. This being said, I regret that, when a problem is reported again and again and that no-one with in depth knowledge of the root causes jumps in.
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
So, add the print and tell what you get before crash: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(indexPath.row) print("unlocked:", self.unlocked.count, "locked:", self.locked.count) // -- add this tableView.deselectRow(at: indexPath, animated: true) if indexPath.section == 0 { let icon = self.unlocked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark } } else if indexPath.section == 1 { let icon = self.locked[indexPath.row] setIcon(name: icon) if IconChange.setIconPurchased == true { iconSelected = names[indexPath.row] UserDefaults.standard.setValue(names[indexPath.row], forKey: "iconSelected") IconSelector.reloadData() tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark IconChange.pushBack = true self.navigationController?.popViewController(animated: true) } } } My guess is that indexPath.row gets larger than the array size.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
Good you found a solution. I fixed it again by instead of using num unlocked using unlocked.count and locked.count. But I could not see num unlocked anywhere in your code. Anyway, don't forget to close the thread.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
Once an icon gets purchased, setIconPurchased gets set to true, and then if it equals true it does more actions. If so, why don't you launch the other action in the same func where you set setIconPurchased to true ? But the overall problem is that your code is too complex. One reason is that you store ate of cells in different arrays that you need to sync.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to UIPickerView button not worked
Would you mind showing the complete code for BNPickerView ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Fatal error: Index out of range. In for loop using an array.
You can also create the array with the right number of elements : let maxLevel:Int = 99 var randomSeq: [Int] = Array(repeating: 0, count: 99). // Array full of zero ; in playground, you can use maxLevel here Now, you can use your code Take care in your loop, array indexes start at zero: for i in 0...maxLevel-1 { randomSeq[i] = Int.random(in: 1...4) or for i in 0...randomSeq.count-1 { randomSeq[i] = Int.random(in: 1...4)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
MKOverlay is a protocol. And type is effectively MKPolyline In the GitHub code, they note: // MKPointAnnotations and are not MKOverlays. var points: [MKAnnotation] { return _placemarks.compactMap{$0.point} } So, to get the points, instead of using         let overlays = self.kmlParser.overlays did you try using         let points = self.kmlParser.points (but that may be only the coordinates of the annotation, not your line).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
(lldb) po overlays[0]                      MKPolyline: 0x60000368bc60 If overlays[0] is in fact a MKPolyline Did you try (overlays[0] as MKPolyline).points()
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Panic-Full iPhone 12 pro
I was told my phone was dying. Who told you ? Apple support ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Sandbox seems to be compromised! need tech contact
The forum is not the right place to get in contact. Contact Apple Support directly.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to How to declare a scope in code ?
There is not other method to declare the scope beside creating a new SwiftUI view file ? Your wording is confusing. You do not declare a scope, you declare something and depending where and how, that defines its visibility scope. Problem you had here was that the declaration was just missing, hence AdvancedSettingsView could not be found in the scope where you tried to use. Note that you can limit scope of visibility, with attributes as private, fileprivate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Cancel button not working?
In the storyboard, select the button for which you want to remove the action. Open the connection inspector on the right panel of Inspectors (last icon on the right in shape of a dot in a circle. You will find either an action or a sent event defined. Click on the small x to remove the connection. Do an option clean build folder to get fully rid of it.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to My app stops in Simulator
Problem was effectively in launchScreen ? So it is solved now ? Don't forget to close the thread on the correct answer.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21