Post

Replies

Boosts

Views

Activity

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
902
Oct ’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.7k
Feb ’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
764
Dec ’21
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
497
Jan ’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
751
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.3k
Feb ’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
534
Feb ’22
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
755
Apr ’22
What is a BLE Scan Request?
Hi, I'm working with a BLE device manufacturer on a new device for which I'm tasked with developing the iOS app. The hardware developer told me: "In response to a Scan request (from a phone or other device) the BLE stack is configured to include a device identifier". The device identifier is something I need to see in the advertising packet before I connect to the device. I don't know what a "Scan request" is. Is this something I have to specifically ask for in my app? Is it something iOS does automatically? Thanks, Frank
0
0
981
Apr ’22
Xcode won't remember Git credentials
Is there any way to get Xcode to remember my Git credentials? My company uses a service called Beanstalk to host our Git repositories. Beanstalk is not one of the choices available under "Source Control Accounts", but the repository itself is a standard Git repository. I can access it by giving my credentials at the time I pull or push, but Xcode forgets them whenever I close it.
0
0
562
May ’22
iPhone app in Portrait only?
I can't get my latest iPhone app to run in portrait mode only. In Xcode I've checked only the box that says "Portrait" under Device Orientation, and I've also examined the Info.plist file to ensure that there aren't any hidden settings for other orientations. I've also tried checking or un-checking iPad, and checking "Requires Full Screen" when that option appears. No matter what I do, when I run the app on my phone and rotate the screen, the interface rotates. What am I doing wrong?
1
0
980
Jul ’22
Weird Swift bug with Equatable
I've got an iOS project that I've been working on for some months. Just recently, I started seeing a compiler error to the effect that "Referencing instance requires that X conforms to Equatable". It shows up in places where you'd expect something to be Equatable, such as the argument to firstIndexOf: on an array. The class in question is written in Swift, but descents from an Objective-C base class. I know there are some issues with how Equatable interacts with Obj-C but I think I've done it right. The base class extends NSObject, and the subclass implements both the isEqual function and the static == function. (I don't think the latter is necessary but I included it just in case). I've tried explicitly including "Equatable" in the definition of the subclass but the compiler rejects this as "Redundant conformance to protocol". I'm not exactly sure how that works since NSObject doesn't extend Equatable but I guess Swift considers them equivalent. Here's where things get super weird though. Xcode still builds and runs the project despite the compiler error, and the code runs, and it works. I even put a breakpoint in the isEqual function to make sure it was getting called. Also, when I clean and rebuild the project, the compiler error often disappears for some time, reappearing hours or days later. So I think this must be some kind of bug in Xcode or Swift itself. What do you think? Frank
1
0
611
Jul ’22
Need help with autolayout solution
Views A and B are equal in width (set up via a constraint). The actual width will vary at runtime. What I want to do is arrange view A such that it is horizontally centered on B but offset to the left by 1/10th of the total width. In other words, if views A and B were 100 units in length, I'd want A to be positioned 10 units to the left of B. If the width were 150 units then the A position would be 15 to the left, etc. I thought I could do this with either a leading constraint or a centerX constraint using a multiplier of 0.9, but it isn't working out the way I want. What's the best solution?
1
0
696
Jul ’22
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
Replies
1
Boosts
0
Views
902
Activity
Oct ’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
Replies
2
Boosts
0
Views
7.7k
Activity
Feb ’22
Silent local notification?
Is it possible to set a silent local notification?
Replies
0
Boosts
0
Views
442
Activity
Dec ’21
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
Replies
1
Boosts
0
Views
764
Activity
Dec ’21
Monitor accelerometer or gyroscope in the background?
Is it possible to monitor the accelerometer or gyroscope when running in the background? My goal is to develop an app that detects sudden accelerations, like if the user fell down stairs, or was in a car accident. Thanks, Frank
Replies
0
Boosts
0
Views
657
Activity
Dec ’21
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?
Replies
0
Boosts
1
Views
497
Activity
Jan ’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
Replies
2
Boosts
0
Views
751
Activity
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
Replies
1
Boosts
0
Views
1.3k
Activity
Feb ’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
Replies
0
Boosts
0
Views
534
Activity
Feb ’22
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?
Replies
1
Boosts
0
Views
755
Activity
Apr ’22
What is a BLE Scan Request?
Hi, I'm working with a BLE device manufacturer on a new device for which I'm tasked with developing the iOS app. The hardware developer told me: "In response to a Scan request (from a phone or other device) the BLE stack is configured to include a device identifier". The device identifier is something I need to see in the advertising packet before I connect to the device. I don't know what a "Scan request" is. Is this something I have to specifically ask for in my app? Is it something iOS does automatically? Thanks, Frank
Replies
0
Boosts
0
Views
981
Activity
Apr ’22
Xcode won't remember Git credentials
Is there any way to get Xcode to remember my Git credentials? My company uses a service called Beanstalk to host our Git repositories. Beanstalk is not one of the choices available under "Source Control Accounts", but the repository itself is a standard Git repository. I can access it by giving my credentials at the time I pull or push, but Xcode forgets them whenever I close it.
Replies
0
Boosts
0
Views
562
Activity
May ’22
iPhone app in Portrait only?
I can't get my latest iPhone app to run in portrait mode only. In Xcode I've checked only the box that says "Portrait" under Device Orientation, and I've also examined the Info.plist file to ensure that there aren't any hidden settings for other orientations. I've also tried checking or un-checking iPad, and checking "Requires Full Screen" when that option appears. No matter what I do, when I run the app on my phone and rotate the screen, the interface rotates. What am I doing wrong?
Replies
1
Boosts
0
Views
980
Activity
Jul ’22
Weird Swift bug with Equatable
I've got an iOS project that I've been working on for some months. Just recently, I started seeing a compiler error to the effect that "Referencing instance requires that X conforms to Equatable". It shows up in places where you'd expect something to be Equatable, such as the argument to firstIndexOf: on an array. The class in question is written in Swift, but descents from an Objective-C base class. I know there are some issues with how Equatable interacts with Obj-C but I think I've done it right. The base class extends NSObject, and the subclass implements both the isEqual function and the static == function. (I don't think the latter is necessary but I included it just in case). I've tried explicitly including "Equatable" in the definition of the subclass but the compiler rejects this as "Redundant conformance to protocol". I'm not exactly sure how that works since NSObject doesn't extend Equatable but I guess Swift considers them equivalent. Here's where things get super weird though. Xcode still builds and runs the project despite the compiler error, and the code runs, and it works. I even put a breakpoint in the isEqual function to make sure it was getting called. Also, when I clean and rebuild the project, the compiler error often disappears for some time, reappearing hours or days later. So I think this must be some kind of bug in Xcode or Swift itself. What do you think? Frank
Replies
1
Boosts
0
Views
611
Activity
Jul ’22
Need help with autolayout solution
Views A and B are equal in width (set up via a constraint). The actual width will vary at runtime. What I want to do is arrange view A such that it is horizontally centered on B but offset to the left by 1/10th of the total width. In other words, if views A and B were 100 units in length, I'd want A to be positioned 10 units to the left of B. If the width were 150 units then the A position would be 15 to the left, etc. I thought I could do this with either a leading constraint or a centerX constraint using a multiplier of 0.9, but it isn't working out the way I want. What's the best solution?
Replies
1
Boosts
0
Views
696
Activity
Jul ’22