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?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
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
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?
I want to customize or limit the typing suggestions for a UISearchBar input to a list of known words that exist within the material that is being searched. How is this done?
Thanks,
Frank
How do I disable the predictive text feature (word suggestions) of the keyboard when used with a UISearchBar?
Do string functions such as "replacingOccurrences" and "trimmingCharacters" always return a new string, even if the old string did not need to be modified?
In other words -- if I'm doing a large number of "replacingOccurrences" in my app but only a small number of the strings actually contain the sequence I want to replace, should I check to see if the sequence exists before calling replacingOccurrences, in order to avoid an unnecessary string allocation?
I would guess that Swift would return the same string if it didn't require any modifications, but the documentation just says "Returns a new string".
Thanks,
Frank
I'm getting the dreaded "Failed to prepare the device for development" error when I connect my iPhone running iOS 15 to the latest version of Xcode. I've tried rebooting both devices. How do I fix this?
I'm trying to save a Dictionary to UserDefaults. My Dictionary is defined as [String:Data]. Since both String and Data are property objects, I expected this to work, but it doesn't: my app blows up with a "this class is not key-value coding compliant" error.
Is this a bug, or am I doing something wrong?
Hi,
My customer wants to do the thing where an app store URL is advertised which contains a referral code. When a user follows the link, it should take them to the app store to install the app, and then when the app is installed, it should be able to get access to the referral code in the original URL.
I know such a thing was possible at one time because I remember talking to some of my colleagues about it, but I have never done it myself and whatever my coworkers did 8 years ago in Objective-C probably doesn't work anymore.
Can someone let me know how to do this, or at least, let me know what the correct name for this procedure is so I can look it up? Thanks.
I'm confused about the SF Pro fonts. Can these be used in our apps?
I tried pasting characters from SF Pro into a label, but was unable to get them to display properly. "SF Pro" doesn't appear in the list of available fonts in Xcode.
If these are not intended to be used by app developers, then what is their purpose?
Are "SF Symbols" different that SF Pro? What about the list of icons that appears in the "Symbols Library" in Xcode? There are so many different sources of symbols and icons, it is very confusing.
If any of these sources is OK to use in an iOS app, is it also OK to export them for use in the event that business needs require me to create an alternate version of my app for some hypothentical non-iOS platform?
Thanks,
Frank
I want to send my app silent push notifications while it is running in the background, but I've been unable to get it to work.
I understand how to send the notification by setting the content-available flag, and I've implemented the "didReceiveRemoteNotification" function in my app delegate. It works, but only if the app is open and running in the foreground. As soon as I put it in the background, didReceiveRemoteNotification doesn't get called again unless I reopen the app.
I feel certain that I should be able to receive these notifications when my app is in the background. I have both "Remote notifications" and "Background processing" checked in Signing & Capabilities.
Thanks,
Frank
I have a table cell containing a UITextView. The table is using automaticDimension for the cell height and the cell itself is formatted in a way that the UITextView can be a variable height.
The intention is that the textview and the cell should reisize as the user types and the text flows into additional lines. If I do nothing else, this doesn't happen.
If I add a UITextViewDelegate and call sizeToFit() on the textview whenever the text changes, and then reload the table cell, it does resize, but it does so in an extremely sloppy and unusable way. Specifically, the textview loses focus, the cursor disappears, and the text starts to render in odd ways with overlapping characters or graphics from surrounding elements.
What is the correct way to accomplish this?
Thanks,
Frank
I'm working on a BLE app with a hardware partner using samples of their device, which I am able to erase and re-flash when needed.
When I try to use the device it initially works fine. I can connect to it, make requests, and get back responses.
However, after a short time and a few successful runs, I start getting the error "Encryption is insufficient". The error is seen in the "didUpdateValueFor" function. I can still connect to the device, and enumerate all of its services and characteristics, but I can't read any data.
If at this point I re-flash the device and also go into the iOS setting app and "forget" it, then I can use the device normally again, at least for a while.
What causes this? Is there a way I can fix it in my app?
Thanks,
Frank
I manage several different apps for different customers, who have invited me as a user to their Apple Developer accounts.
This week a new customer invited me and I accepted the invitation. If I go to App Store Connect, I can select that customer, view the Users screen and see that he has given me Admin access which is what I requested.
However, when I go to developer.apple.com/account, I cannot access the "Certificates, IDs & Profiles" section. In fact, I do not even see the new customer in the pick list underneath my name.
This customer is non-technical and needs me to do everything involved with publishing his app, starting with creating the App Store listing and certificates. In App Store Connect I can "Add App" but there are no bundle IDs in the pick list. If I click the link that says "Register a new bundle ID" it takes me to the Certificates page but with a different customer's account selected.
Why am I unable to do this given that I have Admin access? Is there some other way I can set up this app?
Frank
I have chronic problems with the connection between Xcode and my phone.
I plug the phone in and Xcode says "Waiting for phone to unlock", but the phone is already unlocked. I try locking and unlocking it, but nothing happens.
If I can get past this problem by disconnection and reconnecting the phone a couple of times, it gets into the "downloading symbols" phase and never gets out of it.
Finally, even though I have checked the "Connect via network" option, it never works, and I can never connect unless I plug in the phone with a USB cord (yes, the phone and the computer are on the same Wifi network).
Some days this is just an annoyance, but some days (like today) I really need to test something on my phone for a customer who's waiting for it, and I cannot. The thing I'm trying to test involves sending text messages so I can't use the simulator or even an iPad. What can I do to debug this problem?