Post

Replies

Boosts

Views

Activity

Silent notification appears on home screen when app not open
I'm trying to send my app silent push notifications by setting the "content-available" flag to 1 in the notification payload. This works, but there is a problem: if my app is not running in the foreground, the notification is visible on the home screen. I don't want this: I just want the app to see it, without waking up the screen or alerting the user. If the app is open when the notification comes in, it works as expected; I receive the notification inside my app, and iOS does not display any alert or banner. I configured my app with the "Remote Notifications" background mode. What am I doing wrong?
1
0
721
Apr ’22
Customer cannot access private app update
I have an app that I distribute to an Enterprise customer via private app store distribution. Recently, I published an update. The update went through the App Store review process, was approved, and is currently listed as Ready for Sale. However, my Enterprise customer says he cannot access the update. His view of the app still shows the latest version as being the prior version. I can't figure out what is wrong. Is there some additional step I need to take to make sure the app is available to him? Thanks, Frank
0
0
498
Feb ’22
What is a UTI?
Hi, I'm looking at the function activityViewController(_:dataTypeIdentifierForActivityType:) in the UIActivityItemSource protocol. The documentation says "For items that are provided as data, returns the UTI for the item." The return type of the function is a String. I don't know what "UTI" means in this context. The data I'm trying to provide is an HTML document (a string containing HTML). I tried returning "text/html", but I don't think this worked. I'm also unsure whether my "itemForActivityType" function ought to be providing the HTML as a String, or perhaps converting it to Data first. The end result I'm seeing is that I can share the HTML document via Mail, and it looks fine, but if I try to air drop it, I get an error that says "Extension request contains input items but the extension point does not specify a set of allowed payload classes." I'd like my app to be able to share the HTML document via Mail or Airdrop. I don't care if it doesn't support sharing to any other services. Thanks, Frank
1
0
1.1k
Feb ’22
Swift string manipulation
I need to do something that seems simple but I can't figure out the right syntax. Given a string, I need to search for the first occurrence of a substring (not a character). If found, I need to create a new string by removing the part of the old string that is before the substring. I can't see how this is done in Swift. There is a "firstIndexOf" function, but it only searches for one character at a time. I also know that there is a "range(of:)" function, but I can't find its documentation, and I don't know what the return type is, or how I would use it. Thanks, Frank
2
0
682
Feb ’22
Xcode won't remember Git credentials
Xcode won't remember my Git credentials if I close and re-open it. It remembers them while Xcode is running, but always asks me again whenever I shut it down and reopen it. My Git repository is hosted with Beanstalk, which is not one of the ones listed in the drop-down list in Xcode. I have saved my credentials with Git on the command line and I'm able to do Git command line operations without re-entering them, but Xcode doesn't seem to recognize this. I'm really getting tired of retyping my password all the time. What else can I do?
0
1
467
Jan ’22
Bluetooth scanning in background without service ID?
Is there any way to scan for Bluetooth advertising messages while in the background if the device doesn't advertise any service IDs? I've been asked to build and app that does this. The device in question is an off-the-shelf medical alert button (my company doesn't make the device and can't alter its firmware). Upon examining it, I find that it does not advertise any service IDs nor does it offer any ability to connect, it works purely by sending advertising packets. I'm told that there are Android apps that can work with this device even while in the background. I checked the iOS bluetooth docs to see if any new scanning capabilities had been recently added, but could not find anything. Thanks, Frank
1
0
713
Dec ’21
Format Decimal as string in Swift?
I'm trying to figure out the right way to format a Decimal number as a currency value in Swift. For example, if the Decimal contains the value 25.1 I'd want this to print as "$25.10". If it had the value 25, I'd want "$25.00". If it happened to contain a value like 25.4575, I'd want to round it off and display "$25.46". There are a confusing amount of functions surrounding Decimals and string formatting. I know I can't just use String(format: "%.2f", value) like I can do with floats and doubles. There appears to be a new FormatStyle property of Decimal, but I can't use that yet because it requires iOS 15. Thanks, Frank
2
0
7.5k
Oct ’21
ARKit with map data?
Hi, I've been asked to estimate a project that would require ARKit, unfortunately I'm new to the technology and need some quick answers as to how it works. The app my customer wants to build would overlay simple graphics at street addresses, as the user pointed their camera at buildings or storefronts. For this to work, I'd need to be able to have the AR view tell me what map locations or street addresses are being seen in the camera view. Is this possible? Thanks, Frank
1
0
850
Oct ’21
SwiftUI dynamic positioning of a subview
Hi, I'm trying to figure out how to manually position a subview within a view using SwiftUI. For example, when the user taps the screen, I want to place a small icon on the screen at the position tapped. I know how to get the coordinates of the tapped location but I don't know how to either place a view there or move an existing view already being shown to that location. In a regular non-SwiftUI app I can set the frame, or set up constraints. I don't know what the best approach is in SwiftUI. Thanks.
1
0
438
Oct ’21
Sign In with Apple - Not getting email address
I'm using Sign In with Apple and requesting both .fullname and .email. The first time I sign in on any given device, the callback to my app has an authorization credential that contains an email address and a fullname, as expected. However, any subsequent login on the same device does not return either the email address or the fullname. All I get is the user ID string. The server I'm working with requires an email address to log in, so I need that email address. Why does it only appear the first time? Frank
2
0
1k
Sep ’21
How to create US Central timezone in Swift?
The server I'm working with returns a date/time string that is always expressed in US central time. There is no timezone information in the string itself. In order to parse this string, I need to create a DateFormatter and then assign its timeZone property. I'm having trouble figuring out the right way to do this. I know that the correct string that means US central time is "America/Chicago", but it appears that the TimeZone initializer is looking for an abbreviation, rather than a full string. I don't know what the correct abbreviation is. I don't want to use "CST" or "CDT" since those denote standard or daylight time. I need something that means whatever the current timzeone is in Chicago. In Java, as an example, the Timezone class accepts "America/Chicago" as an initializer and it works whether or not the calendar is on daylight savings time. Thanks, Frank
2
0
1.8k
Aug ’21
async/await in Swift
I happen to have a lot of experience writing a Windows application in c#, where the async/await pattern has been a standard feature for years. I can say from this experience that it's a great way to handle concurrency and I'm really happy that Apple is bringing this to Swift. I'm often critical of language improvements that end up reproducing things you could already do with a different syntax, but in this case it's definitely worth it. If you've never used async/await, it may initially look confusing. It looks like all you're doing is blocking your thread from running until another thread completes, but what really happens is that your thread returns at the point where the await keyword appears, and then resumes later when the result is available. So if your thread is the main thread, which is the most common case, using await doesn't block the main thread. Exactly how the compiler manages to suspend and resume the thread without destroying your local variables, I don't know, but I'm sure they figured out a way that makes sense. Frank
1
1
1.4k
Jun ’21