Post

Replies

Boosts

Views

Activity

Unwind doesn't work under iOS12
I have developed my first App with iOS 13 as the target. I use a split-view controller and from the "Detail page" of that Split-view, I segue to 4 other ViewControllers ("Present Modally"). The Unwind from these are buttons Cntrl-Dragged to Exit, where I select a function present in the SplitView Controller. From the "Master page" of the split-view, I segue ("Present Modally") to 3 different Navigation Controllers, each of which contains a "normal" ViewController (embedded just to easily get the top bar). The Unwind from these 3 ViewControllers is done in the same way described above.All of this works great in iOS 13. Some potential customers asked to support iOS 12 (which I have never developed under). I didn't have to make too many changes to do this, but I seem to have missed something.The Unwinds from the first four segues continue to work just fine.The Unwinds from the last three segues don't work at all. The user is stuck viewing those pages forever. (Yes, on a real device; not just the simulator.)Looks like there are two differences here: Detail vs Master page as the origin, and the use of Navigation Controllers on the failing cases. Any insights greatly appreciated! Barry
4
0
1.3k
Dec ’19
When & how often to do receipt verification
I'm wondering when and how often to do receipt verification for non-consumable purchases. I can certainly verify right after I get the transaction== .purchased notification (delegate call).But it seems like I'd also want to ask for a receipt referesh at some frequency (weekly?) and re-verify just in case they have a ****-broken phone and have fudged my record of their purchase, or Apple has given them a refund for their IAPurchase. Am I correct that the receipt-refresh would be transparent to the user as long as they stay signed-in to their app-store account?Thanks for your thoughts. Barry
3
0
1.3k
Dec ’19
How to force a dot for decimal pad
I have a UITextField that I am using to enter IP Addresses. I am using the Decimal Pad keyboard for this field.IP Addresses are dotted-decimal in all regions (to best of my knowledge). I want to force the "decimal" on the pad to be DOT regardless of region. I have searched here and found several bug reports, but no answer.On another site I saw a recommendation to subclass UITextField to deliver a UITextInputMode.primaryLanguage that keeps DOT. I found that UITextField does call for UITextInputMode, but it never queries the "primaryLanguage" of that mode (so overriding it doesn't help).I've also seen some reports that say that the decimal is determined by the Region rather than the language (and I don't know how to override region for a UITextField).How do I make the decimal stay a DOT for UITextField? Thanks!
9
0
11k
Jan ’20
Taxes in Exhibit B.2 countries
No, I'm not asking for tax advice here.What I would like ot know is...how are most people handing the requirement in the Section 2, Exhibit B, number 2 ? At the time of this writing it reads:"2. Apple shall not collect and remit the taxes described in Section 3.2 of this Schedule 2 for sales of the Licensed Applications to End-Users located in the countries listed below, as updated from time to time via the App Store Connect site. You shall be solely responsible for the collection and remittance of such taxes as may be required by local law."...I am a tiny company. I assume that if Apple found it not worth their effort to figure out that tax requirements in that long list of countries, it is not something that any of us would want to try to handle either?Am I missing something? So mostly everyone is just not selling in those countries? (Sadly, a couple of my Beta testers were in one of these countries and I fear that I must now abandon them.)
7
0
2.9k
Jan ’20
Debug a frozen app
A user says my distributed app is freezing up after a few seconds. I don't have access to his phone.I have no clue how to debug a problem like this from afar.My only thought is if the user could do something to the app to make it crash...then I woud get a crash log.But I can't find anyone who can tell me how to make an app crash (other than in code).Any ideas?Perhaps I could give him a TestFlight version of the app that contains a timer that would programatically force a crash after 10 seconds?
5
0
4.0k
Jan ’20
showBluetoothAccessoryPicker
It doesn't work.I have an MFi device paired but not connected in my Bluetooth devices list. The manufacturer says it does IAP. Even with a nil predicate, the showBluetoothAccessoryPicker brings up an empty screen (and when it does that, it logs this nasty message about "This NSLayoutConstraint is being configured with a constant that exceeds internal limits" (that people have been complaining about for a couple of years). Having the MFi device already connected also doesn't cause the Picker to show it.Am I doing something wrong, or is this just messed up? Barry
7
0
2.5k
Jan ’20
catch performSegue(withIdentifier)
performSegue(withIdentifier) documentation says "This method throws an Exception handling ..." (sic)yet the function is not marked as "throws".I know for a fact that it causes an exception in some cases.I try to put it in a do/try/catch block and Xcode tells me"No calls to throwing functions occur within the 'try' expression" and"'Catch' block is unreachable because no errors are thrown in the 'do' block"How do I trap this exception? Thanks.
4
0
1.5k
Jan ’20
Carriage-return New-Line (aka linefeed)
Perhaps this will save someone else from deciding that they've lost their mind.I receive String data from hardware. I get several "lines" of data at a time, separated by carriage-return characters (0x0d) -> "\r".I split the data into "words" with code like:let splitChars = "\r " // carriage-return and spacewords = incoming.split() { splitChars.contains($0) }Then I encoutered hardware that was sending carriage-return and new-line to end each line (0x0d0a) -> "\r\n" which of course my code didn't handle. So I change it tolet splitChars = "\r \n"and it didn't work. I tried lots of combinations. Finally I settled onlet splitChars = "\r\n "and that did work... unless they weren't sendng the new-lines... then I was broke again.So here's the facts:In a String, "\r\n" is ONE character.It matches only the "character" that is "\r\n".It does NOT match "\r" or "\n". If you want to match both types of input, you need:let splitChars = "\r\n \r"If you need to match new-line by itself also, you can do: let splitChars = "\r\n \n\r"because "\n\r" is TWO characters, not one.My sanity is restored (sorta). Barry
4
0
5.7k
Jan ’20
Text Styles options missing
I'm using the latest XCode (11.3.1), and it seems broken.Looking at a Label in my Storyboard, in the Attributes Inspector, for Font, I used to be able to select various "Text Styles", things like "Body", "Headline", etc. This is greyed out now. Also, when I do Edit->Format->Font the "Show Styles" option is greyed out.I even opened a project that is using Text Styles on existing labels. When I try to look at the other options, the Text Styles is still greyed out, even though the label font is currently set to one of those (now non-existent) styles.Did they remove this intentionally? Is it just my Mac (also running the latest software).Thanks. Barry
4
0
2.0k
Feb ’20
UIMenuController won't open sub-menu
I am basically trying to replicate the "Replace ..." edit menu behavior (but with my own function different than Replace). I have read a lot of posts about others having problems with UIMenuController and don't have any of the known problems. In a UITextView, I select some text. The edit menu comes up with the expected items, including my "Translate..." option. When I click on "Translate..." in the menu, the menu closes and invokes my selector. That code changes the menu items to the sub-choices I want. I call UIMenuController.shared.showMenu(from: self.view, rect: windowBounds) but the menu is not re-shown. ("self" is a sub-class of UIViewController.) In testing this, I see that canPerformAction() is called as expected. I do get a call to my notification for willShowWindowNotification before the menu is shown the first time, but I do NOT get that notification before the menu should be re-displayed. (I do get the expected calls to canPerformAction(), verifying that the menu items are valid, but nothing after that.) If I move one of the end-points of the selected text, this causes the menu to be shown again, and it has my sub-menu items in it as expected. I know this should work because "Replace..." does it all the time. My code is shown below. Any suggestions greatly appreciated! Barry @objc private func translateSelectionMenu() { let sharedMC = UIMenuController.shared // Create menu choices for the translate sub-menu. let charChoice = UIMenuItem(title: "To Chars", action: #selector(translateChars)) let byteChoice = UIMenuItem(title: "Byte Decimal", action: #selector(translateByte)) let halfChoice = UIMenuItem(title: "2-Byte Decimal", action: #selector(translateHalf)) savedMenuItems = sharedMC.menuItems sharedMC.menuItems = [charChoice, byteChoice, halfChoice] // Figure out where to put the menu. // Given my view layout, the menu is always going to be above the selected text. // Look at all the real selection rects to find the highest and widest rectangle. ... code omitted for brevity. This determines the selected rectangle coordinates. Values plugged in below. let textBounds = CGRect(x: 114.1, y: 73, width: 48, height: 55) let windowBounds = TextView.convert(textBounds, to: nil) // Results: 149.1, 284, 48, 55 // sharedMC.update() TextView.becomeFirstResponder() // Unneeded since it already is first responder. sharedMC.showMenu(from: self.view, rect: windowBounds) // No errors, just does nothing. }
1
0
1.2k
Jul ’20
error: The WKWatchOnly key must be present in your WatchKit extension's Info.plist, not the WatchKit app's.
I am receiving the subject error when building my watch-only app to install on my actual watch via iPhone. It does not occur when building for the simulator. This is Xcode 13 so the Info.plist isn't a separate file anymore. Indeed, this key is present in both places, but I didn't add it there and to my knowledge I can't remove it. Any Help appreciated. All operating systems at latest levels. Barry
0
0
541
Feb ’22
UITableView editing broken in iOS 17
I have a dynamic table with 2 sections; 5 rows in the top section and the rest in the second section. I have only the drag handles editing enabled. In earlier versions of iOS, when a row is dragged into the top section from the lower section, it forces a row to move from the end of the top section into the bottom section (so that the top section remains at 5 rows). In iOS17, this no longer happens. The top section (which is specified as 5 rows in the numberOfRowsInSection delegate method) now has 6 rows. Similar problem if rows are dragged out of the top section. It shrinks rather than bringing in a row from the section below it. I will open a formal report on this. Barry
2
0
476
Sep ’23
PushKit (fileProvider) calling didInvalidatePushTokenFor instead of didUpdate (credentials)
I think I've got all the keys and entitlements set up ok. I have no problem receiving normal alerts via the UNUserNotifications framework. Now I'm trying to use PushKit (for fileProvider). I have the following in my AppDelegate fileProvider = PKPushRegistry(queue: nil) fileProvider.delegate = self fileProvider.desiredPushTypes = [.fileProvider] along with the required delegate functions. I am never provided with credentials, only an immediate call to the didInvalidatePushToken delegate. Any suggestions appreciated.
0
0
513
Apr ’24