Hi,
I have a controller where the user can search for map locations or points of interest by typing inside a search box.
To retrieve the list of results I set the queryFragment parameter of a MKLocalSearchCompleter with the search content.
This correctly gives me back a list of MKLocalSearchCompletion of locations and points of interest.
When a user tap on one of this locations, I need to load the coordinates.
In order to do that I do a MKLocalSearch passing the selected MKLocalSearchCompletion, like so:
let item = items[indexPath.row]
let request = MKLocalSearch.Request(completion: item)
let search = MKLocalSearch(request: request)
search.start { (response, error) in
//Do stuff with the result.
//For some specific items I receive an MKErrorDomain 4 error.
}
This works most of the time, but for some specific items the MKLocalSearch call return the error:
Error Domain=MKErrorDomain Code=4 "(null)" UserInfo={MKErrorGEOError=-8}
This error correspond to "placemarkNotFound", ie MapKit is not able to find a placemark for the specific MKLocalSearchCompletion.
I just don't understant why this should be the case.
The MKLocalSearchCompletion is returned by MapKit.
If it is returned by MapKit then a corresponding placemark should exist, right?
Why then is MapKit unable to perform a local search on it?
The problem now is that I present the user with a list of completions returned by MapKit but tapping some of them nothing happens because I cannot determine their respective coordinates.
Why is the search failing sometime? I miss something?
Thank you
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I just discovered a weird bug with UITextView on iOS 16 beta 4.
For some reason now, when the scrolling is disabled, the intrinsic content size of the text view is considering the line spacing even when the textview is empty.
For example, in the below code we are setting a big lineSpacing of 50 to the text view typingAttributes attribute.
class ViewController: UIViewController {
@IBOutlet weak var textView: UITextView! {
didSet {
//Let's set the textView typingAttributes with a lineSpacing of 50.
var attributes = [NSAttributedString.Key: Any]()
let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 50
attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle
attributes[NSAttributedString.Key.font] = UIFont.preferredFont(forTextStyle: .body)
textView.typingAttributes = attributes
}
}
}
On previous iOS versions, everyting it's ok and the line spacing is added only when there are more than one line (see below image).
However, on iOS 16 beta 4, the line spacing is added also when the content is empty (see below image on the left). A soon as we type something the height collapse to the correct height (see below image in the center).
Is this a new expected behavior or a bug? If it is a bug, someone has found a temporary fix for that?
Thank you
I have an entity named Image with a binary attribute named imageData.
I need to cycle trough all Image objects and do something with the data contained inside the imageData attribute.
This is the code:
for image in managedObjectContext.allImages {
autoreleasepool {
var imageData = image.imageData
}
}
I have a lot of objects and every imageData has something like 500KB of data for a total of 3GB of data.
The problem is that each time the imageData attribute is used, the data go into memory and not released until the loop is done. This is causing the memory to grow up to 3GB crashing the app.
I also tried to turn the object into a fault when I'm done with it by calling refresh(_:mergeChanges:) but nothing changes:
for image in managedObjectContext.allImages {
autoreleasepool {
var imageData = image.imageData
managedObjectContext.refresh(image, mergeChanges: false)
}
}
How can I cycle trough all objects without filling up all the memory?
Thank you
Hi,
I have a controlled contained in a split view controller primary controller with a UISearchController assigned in navigationItem.searchController.
On iPhone the search bar is directly displayed in the navigation bar.
This is want I want.
But on iPad, the search bar is hidden and a search button is displayed in the top right of the navigation bar. In order to display the search bar the user must click on the icon to display the search bar.
I want the search bar to always be visible, like on iPhone.
How can I achieve that?
This is the code I use to include the UISearchController:
let searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.obscuresBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
And this is the result on both devices:
Thank you
Just found something weird with the String(localized:) method.
Let's say that I have a "%lld apples" sentence inside a string catalog.
If I call
String(localized:"\(1000) apples")
when on the device settings the number format is "1'234'567.89" and the device language is English, then the following string is returned:
1\'000 apples
Any idea why the ' character has a backslash?
It's a bug or I miss something?
Thank you
Hi!I have a model with an antity that have a property that use the "Allows External Storage" option. For some reason the framework does not handle the files inside this directory correctly when some of the files have the SAME data.Basically the issue is:- You have an entity with a binary property that use the “Allows External Storage” option.- You create some entities and for every entities you put the same data in the binary property.- After saving Core Data will create inside the _EXTERNAL_DATA folder a file for every entity data.- You delete all the entities from the store.- Core Data will delete only a single file and all the other files are left in the directory forever.So if you create for example 10 identical entities (same data) with 1MB of data for every entity, after deleting all the entities from the store your _EXTERNAL_DATA folder will still contain 9MB of orphaned data that will stay there forever. 😟This bug is present in iOS 7, iOS 8 and iOS 9 beta 5.I have made a sample project that illustrate this behavior:http://www.dale1.ch/documents/delete_external_data_sample_project.zipI have filled a bug report (18319761) the 12 September 2014 with all the informations needed to reproduce the issue but unfortunally is still Open and I didn't received any feedback from Apple.Alan
Hi,
I found a case that cause a list to never deselect the row when the back button is pressed.
In the following code I modally present a list. When you select a row another list is displayed. If you select a row of the second list and you go back the row will stay selected.
This is the code:
struct ContentView: View {
		@State var modalVisible = false
		var body: some View {
				Button(action:{
						self.modalVisible.toggle()
				}) {
						Text("Open modal")
				}
				.sheet(isPresented: $modalVisible) {
						NavigationView {
								List {
										NavigationLink("Item", destination: List {
												NavigationLink("Sub Item", destination: Text("If you go back the row will stay selected."))
										})
}
}
}
}
}
Does anyone know if there is a way to force the list to deselect the row when the back button is pressed?
Thank you
Hi,
On iOS 13 and iOS 14, if you have a navigation controller that use large titles and you push a controller that does not want a large title (navigationItem.largeTitleDisplayMode = .never) there is a smooth animation between the two navigation bar heights (from the large one to the small one).
On iOS 15 the animation is missing and during the transition the pushed controller view top part is covered by the large title bar until the end of the transition. After the animation is done the height of the navigation bar suddenly becomes small.
Here's the transition on iOS 14. The navigation bar height gradually changes from large to small:
And here's the transition on iOS 15. The navigation bar height is not animated and remains the same until the end of the transition animation:
I opened a bug report regarding this issue (FB9290717) but I want to know if someone has found a temporary fix for this.
Thank you
Hi,
I'm currently let the user pick a photo using PHPickerViewController.
The advantage of PHPickerViewController is that the user is not requested to grant photo access (no permission alerts).
After the user picked the photo I need to take note of the local identifier and the cloud identifier (PHCloudIdentifier).
For the local identifier no problem, I just use the assetIdentifier from the PHPickerResult.
For obtaining the cloud identifier (PHCloudIdentifier, on iOS 15 only) I need to use the cloudIdentifierMappings method of PHPhotoLibrary.
The problem of that method is that is causing the photo library access permission alerts to display.
Someone know if there is another way to get the cloud identifier from a local identifier without having to prompt the user photo library access?
Thank you
Hi,
Just want to understand what is the current state of iOS 15 prewarming app delegate behaviour.
There is a lot of confusion (and a lack of documentation) about which app delegate methods are called during prewarming.
It's not clear if didFinishLaunchingWithOptions will be called or not during prewarming.
A lot of applications are counting on UserDefaults and Keychain access in didFinishLaunchingWithOptions, but sadly these two features seems to be unavailable during prewarming causing issues.
Some users say that this was the case before 15.4 and that from 15.4 the didFinishLaunchingWithOptions app delegate method is no more called during prewarming.
Just want to know if we can have an official statement about this.
It is safe, from iOS 15.4 onwards, to use UserDefaults and access Keychain in the didFinishLaunchingWithOptions app delegate method?
Thank you
Hi,
I'm looking for a way to do something when the user presses the window red close button on a Catalyst app. For example, in some cases, I need to display an alert and prevent the window from closing.
On AppKit we can use the windowShouldClose delegate method of NSWindowDelegate. Unfortnuately this is not available on Catalyst.
Did someone found a way on Catalyst to prevent a window from closing? Maybe there is a way to expose the AppKit NSWindowDelegate object?
Thank you
I’m exploring the new Xcode 15 string catalog feature.
I see that for every sentence there is a “screenshots” field in the Xcode inspector (see image). How can we populate this field?
Thank you
Is it possible to use a string catalog to localize a settings bundle?
Currently, to localize a Settings.bundle, we need to create a folder for each language with a single strings file inside.
For example:
Settings.bundle
en.lproj > Root.strings
fr.lproj > Root.strings
de.lproj > Root.strings
...
Any way to convert that to a string catalog?
Thank you
Hi!I hope someone can help me.A user told me that my app crashes when scrolling a tableView on iOS 13.1.2.I received the crash log and the error it’s just crazy.The crash log indicate that the error is at the first line inside the trailingSwipeActionsConfigurationForRowAt method.override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard items.count > indexPath.row else {return nil} //This line crash.
…
}The items property is defined as:private var items = [AnyObject]()The error is EXC_BREAKPOINT (SIGTRAP).How can this line of code crash? items is a non optional variable and indexPath is also a non optional struct.It's as if indexPath.row was deliberately creating an EXC_BREAKPOINT exception. It is possible?Another strange thing is that the user say that the app crash during scrolling. It seems that the method trailingSwipeActionsConfigurationForRowAt is called during scroll. That's also strange, it should not be called only when the user does a left swipe? Maybe it has something to do with some accessibility feature because in the call stack of crash report I see some system accessibility methods calls (see crash report below).Has anyone any ideas that can help me or has encountered a similar problem?Thank youException Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001de522a94
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [1431]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libswiftUIKit.dylib 0x00000001de522a94 $s10Foundation9IndexPathV5UIKitE7sectionSivgTm + 52
1 libswiftUIKit.dylib 0x00000001de522a78 $s10Foundation9IndexPathV5UIKitE7sectionSivgTm + 24
2 MYAPP 0x000000010219ca4c specialized GroupTableViewController.tableView(_:trailingSwipeActionsConfigurationForRowAt:) + 272 (GroupTableViewController.swift:714)
3 MYAPP 0x0000000102194544 @objc GroupTableViewController.tableView(_:trailingSwipeActionsConfigurationForRowAt:) + 136 (:0)
4 UIKitCore 0x00000001ad6ae200 -[UITableView _trailingSwipeConfigurationAtIndexPath:fromRemoveButton:] + 2140 (UITableView.m:16580)
5 UIKit 0x00000001de7889f0 -[UITableViewCellAccessibility _privateAccessibilityCustomActions] + 544 (UITableViewCellAccessibility.m:3153)
6 UIAccessibility 0x00000001b49e6228 -[NSObject(AXPrivCategory) _retrieveCustomActionsForElement:] + 72 (NSObjectAccessibility.m:2973)
7 UIAccessibility 0x00000001b49e650c -[NSObject(AXPrivCategory) _accessibilityCustomActions] + 260 (NSObjectAccessibility.m:3021)
8 UIAccessibility 0x00000001b49e9978 -[NSObject(AXPrivCategory) _accessibilityCustomActionNamesAndIdentifiers] + 68 (NSObjectAccessibility.m:3683)
9 UIAccessibility 0x00000001b49f07bc -[NSObject(AXPrivCategory) _iosAccessibilityAttributeValue:] + 6580 (NSObjectAccessibility.m:6542)
10 UIAccessibility 0x00000001b49d1d9c _copyMultipleAttributeValuesCallback + 544 (UIAccessibilityRuntime.m:344)
11 AXRuntime 0x00000001b39fc834 ___AXXMIGCopyMultipleAttributeValues_block_invoke + 64 (AccessibilityPriv.m:1192)
12 AXRuntime 0x00000001b39fc3a8 _handleNonMainThreadCallback + 68 (AccessibilityPriv.m:467)
13 AXRuntime 0x00000001b39fc6b8 _AXXMIGCopyMultipleAttributeValues + 304 (AccessibilityPriv.m:1191)
14 AXRuntime 0x00000001b39f658c _XCopyMultipleAttributeValues + 396 (AccessibilityClientDefsServer.c:1354)
15 AXRuntime 0x00000001b3a0bd28 mshMIGPerform + 272 (MachServerHelper.c:447)
16 CoreFoundation 0x00000001a939d91c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60 (CFRunLoop.c:1937)
17 CoreFoundation 0x00000001a939cfe8 __CFRunLoopDoSource1 + 448 (CFRunLoop.c:2075)
18 CoreFoundation 0x00000001a9397c20 __CFRunLoopRun + 2144 (CFRunLoop.c:3098)
19 CoreFoundation 0x00000001a9397098 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)
20 GraphicsServices 0x00000001b3501534 GSEventRunModal + 108 (GSEvent.c:2246)
21 UIKitCore 0x00000001ad4b77ac UIApplicationMain + 1940 (UIApplication.m:4753)
22 MYAPP 0x000000010209cae8 main + 68 (PlaceViewController.swift:25)
23 libdyld.dylib 0x00000001a9216f30 start + 4
Hi!I noticed a strange behavior on MapKit when using the iOS 11 clustering feature.If you add some annotations on a map (with same clusteringIdentifier and same displayPriority) MapKit will correctly merge together annotations that are close.The problem is that if you remove all the annotations and then you add them back the map will no more merge the annotation together. It’s like the clustering feature simply stop working.I don’t really know if it is a bug or if I miss something.Someone else have noticed this?Alan