Post

Replies

Boosts

Views

Activity

MapKit: hide title on callout OR any way to detect before annotation is selected
Hi, I am using a rich, detailed view to show information in an MKAnnotationView's detailAccessoryView. As such, I don't need to use the 'title' or 'subtitle' fields that come with the callout view. However, I also want to show the 'title' under the MKMarkerAnnotationView on the map. Unfortunately it looks like the same MKAnnotation's 'title' property is used for both the marker's name on the map, as well as in the callout view. So I'm trying to figure out if there's any way to hide the 'title' in just the callout view. One thing I was considering was hiding the 'title' when an annotationView is selected, but doing this in 'didSelectAnnotationView' is too late to take affect for the callout view, and there doesn't seem to be an option for a delegate call like 'willSelectAnnotationView'. Is there any other way to figure out just before the annotation is selected?
0
1
872
Apr ’21
macOS Monterey partition missing "SF Pro Text" font
I want to use the "SF Pro Text" font in my app. It works fine when I build my app on my main computer running macOS11 Big Sur, but I have a 2nd partition to run macOS Monterey, and it doesn't seem to be available there at all, whether through Interface Builder or through code (using NSFontManager). Using this returns nil on my Monterey partition: NSFont* regularFont = [[NSFontManager sharedFontManager] fontWithFamily:@"SF Pro Text" traits:NSFontWeightRegular weight:5 size: 16.0]; Maybe I'm missing something here ... should I have to install the font manually? I thought the SF Font is a 'system font', so it would be available on all Macs?
1
0
1.5k
Feb ’22
CLGeocoder geocodePostalAddress returning a lot of kCLErrorGeocodeFoundNoResult errors
I have been using CLGeocoder’s “geocodePostalAddress” API for many years, and it’s been working just fine. Since yesterday, a lot of users have started complaining that they are getting “no results” for their geocoding requests, and I have also confirmed this case. It seems like the “geocodePostalAddress” returns “No Result” in many cases where it used to work correctly before, even though the “geocodeAddressString” API still works correctly. Has anyone else noticed this problem? Has there been some server change that is causing this? Here's a unit test I wrote to test this out: import CoreLocation final class CJTestCLGeocoderRequests: XCTestCase { func testGeocoderWithCNPostalAddressBerkeley() async throws {         let geocoder = CLGeocoder()         do {             let postalAddress = CNMutablePostalAddress()                         postalAddress.street = "2300 College Ave"             postalAddress.city = "Berkeley"             postalAddress.state = "CA"             postalAddress.postalCode = "94108"             postalAddress.country = "United States"             let placemarks3 = try await geocoder.geocodePostalAddress(postalAddress)             XCTAssertTrue(placemarks3.count > 0, "Geocoder works and gets an placemark")             XCTAssertTrue(placemarks3.first?.postalCode == "94108", "Geocode placemark has right postal code")         } catch {             XCTFail("Geocoder failed: placemarks = \(error).") // get failure here, with error code 8 (         }         do {             let collegeAveString = "2300 College Ave, Berkeley, CA, 94704, United States"             let placemarksString = try await geocoder.geocodeAddressString(collegeAveString)             XCTAssertTrue(placemarksString.count > 0, "Geocoder works and gets an placemark")             XCTAssertTrue(placemarksString.first?.postalCode == "94704", "Geocode placemark has right postal code")         } catch {             XCTFail("Geocoder failed: placemark string = \(error).")         }     } Would love any help regarding this.
2
1
1.1k
Nov ’22
Background Tasks for macOS
Hi, I have been using the BackgroundTasks API on iOS for a while, and it works great. I want to do something similar on macOS, where I can easily run some background process from my app every X minutes, even if the app is closed. My Mac app runs in the sandbox, and isn't Catalyst-based, so I can't run the UIKit 'BackgroundTasks' API, and I haven't found anything similar on macOS. Does something like that exist, that is easy to adopt?
2
1
1.6k
Feb ’23
Differences between .framework and .xcframework
Hi, I am developing a 'framework' for a client so they can embed some of my code into their own custom app. I'm confused a bit about the best option to distribute this. I have created an iOS 'framework' within my Xcode project and added all the necessary files there. Can I just build the framework and send them the build folder for the framework? Or is it better to generate an .xcframework that I read about somewhere? I'm just not completely sure about the benefits for distributing an .xcframework file (which there doesn't seem to be an option to generate from Xcode) over just the .framework folder from the built products? Thanks.
1
1
5.7k
May ’23
SwiftUI: memory spike when keyboard is presented
I am working with a UIKit app, which has an MKMapView in it, which displays a bunch of MKAnnotationViews. For each annotation view, I'm using a SwiftUI view to draw the detailAccessoryView. This works, but whenever a keyboard is presented (even if it's in another view controller), I see a major memory spike in the app. For e.g., it goes from using 130MB to 600MB+ on an iPhone8 (the exact values don't matter of course). This explains a crash that seems to be happening with the same app in production as well, which I reported in this DevForums Thread From what I can tell, whenever a keyboard is shown, the SwiftUI views seem go repeatedly resize or re-layout themselves, maybe trying to reconfigure their internal layout or something. If I reduce the number of views in my SwiftUI view, it reduces the memory spike; if I remove the SwiftUI view and just use a plain UIView, the spike completely disappears. My question is: how can I get the SwiftUI views to ignore what's happening with the keyboard in some other view? I've read in some other threads that there is a 'keyboard avoidance' issue with iOS14 and above ... though in my SwiftUI view, there isn't any text field in it's own views. I've tried adding the modifier to the top-level SwiftUI view: .ignoresSafeArea(.keyboard) But it doesn't make a difference Can anyone shed some light on this? Is there another way to avoid keyboard changes in a SwiftUI view?
3
1
1.1k
Oct ’21
SwiftUI List with Core Data / SwiftData - memory usage while scrolling
I want to display a list of 'contacts' in my app, loaded from a local Core Data sqlite database. Currently, I use UIKit, and with UITableView's cell reuse, even with 5000+ rows, the memory usage is great ... it loads at about 80MB and stays around that no matter how much I scroll up or down the list. I implemented the same list with SwiftUI List, and the memory usage while scrolling is very different ... the initial load is about the same, but each time I go down the whole list, it adds 20-30MB to the memory usage (according to Xcode). Is this a side-effect of using SwiftUI's List, or am I doing something wrong here? Here's the implementation: struct CJContactsListView: View { @SectionedFetchRequest var sectionContacts: SectionedFetchResults<String, Person> init() { let fetchRequest = Person.allContactsFetchRequest() _sectionContacts = SectionedFetchRequest(fetchRequest: fetchRequest, sectionIdentifier: \.normalizedSectionLetter!, animation: .default) } var body: some View { List { ForEach(sectionContacts) { section in Section(header: Text(section.id)) { ForEach(section) { person in CJContactsListLabelRowView(person: person) } } } } .listStyle(.plain) } } struct CJContactsListLabelRowView: View { @ObservedObject var person: Person var body: some View { HStack (alignment: .center, spacing: 8) { VStack (alignment: .leading){ if let displayName = person.displayName { Text(displayName).font(.headline) } if let companyName = person.companyName { Text(companyName).font(.subheadline).foregroundColor(.secondary) } } } } } extension Person: Identifiable { public var id: String { return self.objectID.uriRepresentation().absoluteString } public static func allContactsFetchRequest() -> NSFetchRequest<Person> { let request = Person.fetchRequest() request.sortDescriptors = Person.makeSortDescriptors() request.predicate = NSPredicate(format: "(isContactArchived == nil || isContactArchived == 0)") request.fetchBatchSize = 100 request.relationshipKeyPathsForPrefetching = ["tags"] return request } } There isn't a visible performance issue in my testing (i.e. I don't see a 'stutter' when scrolling really fast), but the memory profile growing does concern me, especially when this isn't a problem in UIKit. I've tested the "Earthquakes" sample project from Apple and it seems to display the same issue (memory profile grows substantially as the user scrolls down the list). Would love to know if there's a way to avoid this issue.
0
3
863
Mar ’24
Xcode26: download stuck on 'fetching'
I just downloaded Xcode26, and am trying to download the new simulator to be able to run and test my app. But the downloads folder just shows that it's stuck on "Fetching download information ..." even 15 minutes after it started. I tried restarting Xcode but didn't help. Internet connection is good. Any tips to get it working?
6
3
331
Jul ’25
SwiftUI: dynamicTypeSize doesn't work for items in a List
Hi, I have a List and I want to limit the dynamic text size for some of the elements in the list's row item view. I created a test view below. The ".dynamicTypeSize(.large)" restriction only works if it's applied to the List view, not if it's set for the the ContentItemView in the ForEach below. Is there a reason for this? Do I need to do something else to limit a list row to a certain size? The example only has a text field, but I want to do this for a Image with some text inside it, and I wanted to restrict that text field, but it doesn't seem to work when the view is inside a List row. Please let me know if there's a workaround for it. import SwiftUI import CoreData struct ContentView: View { @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)], animation: .default) private var items: FetchedResults<Item> @State private var multiSelectedContacts = Set<Item.ID>() var body: some View { NavigationStack { List (selection: $multiSelectedContacts) { ForEach(items) { item in ContentItemView(item: item) } .dynamicTypeSize(.large) // <-- doesn't works } .dynamicTypeSize(.large) // <-- THIS WORKS } } } struct ContentItemView: View { @Environment(\.managedObjectContext) private var viewContext @ObservedObject var item: Item @State var presentConfirmation = false var body: some View { HStack { if let timestamp = item.timestamp, let itemNumber = item.itemNumber { Text("\(itemNumber) - \(timestamp, formatter: itemFormatter)") } } .popover(isPresented: $item.canShowPopover, content: { Text("Test Item Label") .frame(width: 100, height: 150) }) } } private let itemFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateStyle = .short formatter.timeStyle = .long return formatter }() #Preview { ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) }
2
2
624
Jun ’25
Deep links for In-app Event page
Hi, I am planning to add a In-App Event for a major update to my app. The Create In-App Event page in App Store Connect seems to want a "Event Deep Link", and I'm not sure how to generate that. I've read about universal links but they seem complicated, and I just want the users to be able to open my app, I don't want a custom landing page in the app. Can I pass in the URL scheme for my app, or something else that's super-simple and gets the job done (like the App Store URL for the app)?
0
2
817
Jun ’24
Claude keeps logging out
Hi, I'm running Xcode version 26.0.1 (17A400). Every time I restart Xcode, it seems to not recognize my Claude login anymore, and I have to go through the whole authentication flow again. It's quite annoying. Does anyone have a solution for it?
1
2
135
Nov ’25
NSSharingService with email for 3rd-party apps
I have a couple of questions about NSSharingService, specifically with NSSharingServiceNameComposeEmail:1) I use [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeMessage], then set the correct parameters and call `performWithItems` on it. This works fine if the Mail app is configured to be the "Default email reader" in Mail.app's Preferences. If I change this to some of the other email clients I have, this doesn't work anymore. I have tried MS Outlook, Airmail and Unibox apps, and this doesn't work in any of them. Is this intentional? Does the sharing service with NSSharingServiceNameComposeMessage only work for Mail.app?2) If that isn't the case, and other apps can be responsible for composing emails as well, what does an app have to do to handle this? If I want to set myself as an email client app, and let others call ComposeMessage, what API should I implement? If anyone has an idea on how to do this, would really appreciate the help.Thanks.
Topic: UI Frameworks SubTopic: AppKit Tags:
3
1
2.3k
Feb ’23
Why do we need receipt validation for IAP?
Hi,I'm starting to work on adding a auto-renewable subscription in my app to unlock certain features. I understand the StoreKit and iTC details, but one thing that's not clear to me is *why* we need to do receipt validation for in-app purchases? There seems to be a lot of empasis on doing this, and it gets complicated because you need to either import different libraries to do this client-side (which isn't the recommended option) or do it server-side, which adds a lot of overhead. In my case, I don't have any server running at all, and my whole app relies on CloudKit instead. So I'm wondering why it's so essential in case of IAP. a) if it's for preventing piracy, shouldn't that apply to paid-apps as well? But no one talks about reciept validation for paid-up-front apps.b) when StoreKit's paymentQueue "updatedTransactions" delegate tells us that someone has purchased an IAP, is that something that can be spoofed? I would imagine not, and even so, this would only be possible with jailbroken devices. Is that what people are worried about? How much of a problem is this in the real world? c) is there certain information in the reciept that is essential for subscriptions to work correctly? In my mind, the simplest implementation would be this: display the IAP products, implement the storekit delegate to see when the user purchased the product and mark that user's CloudKit "User" record with the type and date of subscription (this can also be used to restore the IAP on another device) and unlock the features. When the next billing cycle comes, I can wait for StoreKit to tell me whether the user cancelled or continued the subscription, and lock/unlock the feature accordingly. I don't see the necessity of receipt validation in this case. But I might be wrong and misguided about my assumptions. Would love some comments about this.
15
2
12k
Jun ’21
Xcode Build Timing summary not visible
HiI'm trying to use Xcode's "Build With Timing Summary" feature. It kicks off a build, and I can see the new build in the Build Reports navigator, but when I look through All Messages in the build results, there is "Timing Summary" information. It just says "Build Success - &lt;date&gt; - 75 seconds", but there isn't a breakdown of the timing results.My target builds an iOS app with many extensions, so I can't post the whole logs here. But is there any reason why I can't find the timing results? I do have that older Xcode flag 'ShowBuildOperationDuration' which still works, but only gives the same overall build summary time, not a breakdown.
2
2
3.8k
Mar ’23
How to improve CloudKit server latency when uploading data
I am having a hard time uploading data to my CloudKit container in a series of operations. I have an 'uploader' function in my app that can populate the CloudKit private database with a lot of user data. I batch the records into multiple CKModifyRecordsOperations (with 300 records in each operation as a maximum), before I upload them. When I do this with a lot of data (less than 50MB even), I get CKErrorRequestRateLimited errors for some of the operations, with a value for CKErrorRetryAfterKey specified in the CKError. I respond by creating new operations for the same records, delaying them by the specified CKErrorRetryAfterKey key, and then retrying the operations. But those operations end up getting more CKErrorRequestRateLimited errors again. Usually one or two operations go through at a time, and all others have the same error, and then I have to retry again after 90 seconds or whatever the retry-key says.  Doing all of this can take dozens of minutes to do a simple upload. I checked the CloudKit dashboard, and for the container's 'developer' telemetry section, the 'server latency' seems very very high (over 100,000 for 95% percentile). It also suggests the 'average request size' is 150KB on average across the last few days as I've been testing this, which doesn't seem like a lot. I've tried throttling the requests so only 20 modify operations are sent at a time, but it doesn't seem to help. I'm not sure what else I can try to improve this. I have 'query' indexes for 'recordName' field for each recordType, and 'query, searchable, sortable' on some of the custom fields on the recordTypes (though not all). The CKModifyRecordsOperations' configurations have 'qualityOfService' set to 'userInitiated'. Is there anything else I can try to improve the upload speeds? Or is it out of my control?
2
1
699
Feb ’21