Post not yet marked as solved
I've had two users contact me over an app update. One of its screens isn't displaying some of its content correctly. Come to find out, they had Apple's Display Zoom setting (under Display & Brightness) set to 'zoomed'. When I had them set back to 'standard', no issues. Both users are using an iPhone "Plus" model as their screenshots came back as 1125 x 2001.Problem is, I cannot reproduce this at all on my own iPhone 6 Plus or 7 Plus. From looking at the screenshot, most of the UI is scaled a-ok I then have a view to display a math problem. That view's bounds is also correct. However, the view is drawing the wrong graphics assets which now overflow the view's bounds.For these particular images, I fed Xcode PDF images which under the covers generate standard, @2x and @3x rasterized versions. I used Xcode 8.3.3 to submit the app, so the original PDF data was not included (a feature introduced in Xcode 9). The rest of the UI also makes use of such assets (PDFs dragged in to Xcode). All those images show up a-ok.Unfortunately, the Simulators do not appear to have any setting to simulate Display Zoom. So I have no idea how to fix the issue, other than having users turn off the Display Zoom feature on their end. Both users have been OK in doing that, but this will cause a burden to those that need that feature enabled.Anyone have trouble with part of their app not honoring Display Zoom? Any tips/tricks for attempting to reproduce? About the only thing I can think of is if the bounds is somehow a now-integral size? But why would the issue not exist on all "Plus" devices with Display Zoom on? Maybe different OS versions would round differently? Subtle draw bugs?
Post not yet marked as solved
Well this is new... the Lite version of one of my apps was just rejected because "We noticed that your app icon is identical to the icons of other apps already submitted to the App Store. Apps that use the same icon make it difficult for users to find apps and are considered a form of spam."How on earth is it spam as both apps come from my company! Since 2008 I have been submitted several apps, often in pairs (a free and paid version). Where each pair uses the same artwork for branding purposes. The app name's have the same root (start) and the lite version is suffixed with "Lite". So at most, there are two apps with the same unique artwork from my company.Anyone else dealing with this? I just submitted an appeal.
Post not yet marked as solved
I am no longer able to do any work since my developer account is in this state: "Your Apple ID currently has two-step verification turned on, but two-factor authentication is required."But I cannot enable two-factor authentication since all my trusted devices are assigned to my non-developer Apple ID. And I cannot change that since that AppleID is connected to everything such as iTunes purchases, etc.How are other developers setting things up? Have you had to effectively consolidate Apple IDs and only have one?
Post not yet marked as solved
We were planning to use UI Tests for a work project. For my home business, since 2004, I wrote my own UI testing infrastructure that will serve as a plan B.Anyhow, we found that our first UI test refused to work with a saved file that holds application state. To simpifly this for this discussion, lets say you have a simple file that contains a boolean. false is the default, true means the user configured the app.In our main view controller, we look at our file and then segue to one of two destinations based upon its contents.In the UI Test suite's setup, we added code to write out our file with desired starting state. But when the UI test is run, our app always is in the default state. Unit tests run a-ok. We have tests such as this:assert false that the file existscall some function to create the settings fileassert true it exists and have valid contents.Finally, what's truly strange is that I put print statements in our main controller's viewDidAppear. That's where we load up our settings file and segue appropriately. If I put a breakpoint on that code and run our UI test, the breakpoint is hit. The line is printed to the console. But, our settings file at that point has defaults (not how it was during the suite's setup).But... if I remove that breakpoint and just run the test, I never see the print output in the console. So it has the appearance that viewDidAppear is not being called at all.If anyone can shed light on what may be happening, that would be great. Otherwise, we'll scrap our plans and just use a known working home-grown infrastructure.
Post not yet marked as solved
I cannot find any documenation on Encodable or Decodable as to any claim that computed properties are/will-be always ignored. I'm actually hoping this is the case to allow for less coding.Issue: I have a struct with a fairy large number of properties. I need to add a few computed properties. I've noticed that computed properties are ommitted from the resultant ouput (e.g. JSON, property list). This is nice as I don't have to set up a fairly large CodingKeys enum.Anyone know if computed properties will always be ommitted? If not, the workarounds are to either provide a CodingKeys enum, or to just use functions instead of computed properties.Thank you.
Problem: We have a struct that echoes what our web-based product will send down as JSON. Unfortunately, it's a large list of separate boolean properties. The struct in Swift is effectively:struct SomeStruct : Codable {
var flagOne : Bool
var flagTwo : Bool
...
var flagN : Bool
}For testing purposes, I'd like to create a instance, but don't want to expose a massive init or have to have calling code manually assign properties. What I would like to do is to create an enum as follows and then have some simple init() on the struct to basically allow for say "I want an instance with only the following flags set" where "following flags" is a set/array of the enum:enum Flag : String {
case flagOne, flagTwo, ... flagN // The rawValue now matches the struct properties
}
init(onlyFlags aFlagsArray: [Flag]) {
// Not sure what to do here.
}I haven't found any method such that given a string (e.g. "flagOne"), that I could some how call a "selector" with that name against an instance of the struct. If such a thing is possible, I could create a few variations of init to do stuff like this (after making the enum CaseIteratable):init(allFlagsEnabled anEnabledFlag: Bool) {
for theFlag in Flag.allCases {
// theFlag.rawValue is the name of the property on the struct
// But how to call the setter of that property?
}
}I briefly looked at Mirrors, but that seems to be for read-only access. And, they are effectively value types. So while you can update a value on a mirror, that won't update the original item (struct).I belive this may be possible if this isn't a struct but an NSObject and then attempt something with selectors. But, I'd rather just manually set up the struct's properties as needed at that point.
Post not yet marked as solved
We are updating a very old codebase (2010) that used Objective-C. Users of the app were able to enter in a base URL to either their own server solution, or our company's hosted solution. For the latter, users would typically enter in an http address and via redirects, were ultimately given a secure connection. Reason I added these details is that the URL the users enter is completely arbitrary and not just one fixed domain.For networking, we used NSURLConnection and provided the following delegate implementations.- (BOOL)connection:(NSURLConnection*)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace*)protectionSpace
{
NSString* authenticationMethod = [protectionSpace authenticationMethod];
return [authenticationMethod isEqualToString:NSURLAuthenticationMethodDefault] ||
[authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic] ||
[authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPDigest] ||
[authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}- (void)connection:(NSURLConnection*)conn didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge*)challenge
{
id<NSURLAuthenticationChallengeSender> sender;
sender = [challenge sender];
NSURLProtectionSpace* protectionSpace = [challenge protectionSpace];
SecTrustRef trust = [protectionSpace serverTrust];
NSURLCredential* credential = [NSURLCredential credentialForTrust:trust];
[sender useCredential:credential forAuthenticationChallenge:challenge];
}But connection:canAuthenticateAgainstProtectionSpace: is deprecated. It's my understanding though from reading though docs that one would implement a session-level challenge API. Then for the other piece, a task-level challenge API. Here is our basic Swift (4.2) code (this code is in a view controller which is a URLSessionTaskDelegate: let theURL = ...
let theConfiguration = URLSessionConfiguration.default
theConfiguration.httpAdditionalHeaders = ["Accept" : "application/json"]
let theSession = URLSession(configuration: theConfiguration, delegate: self, delegateQueue: nil)
session = theSession // Saved off to stored property
let theTask = theSession.downloadTask(with: theURL)
theTask.resume() func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
print("we have a sesssion challenge")
}
func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
print("we have a task challenge")
}Problem is, when connecting to a http: URL, it never calls either challenge delegate API. And we get this in the console:Cannot start load of Task since it does not conform to ATS policyTask finished with error - code: -1022Any ideas on how to get this working? Our original app code still functions (I have the original app running on an older device and hitting our hosted server with a http: URL).Also, the docs don't actually tell you what replaces connection:canAuthenticateAgainstProtectionSpace:. And looking up constants such as NSURLAuthenticationMethodServerTrust, show that they are not deprecated. But the docs then link you to a very old article showing you how the old system worked (entitled: Overriding TLS Chain Validation Correctly)Thank you in advance for any tips.
Post not yet marked as solved
I rarely use playgrounds and was planning to do a training on Swift basics for some co-workers.I'm on macOS 10.14.1 with Xcode 10.1 (10B61)Playgrounds though are highly unstable in that they will crash or complain that something isn't compilable when in fact it is when dropped into a Swift project. For the latter situation, here's what I mean:If your playground has an obvious error, it is called out with the inlined error bar. For example:let x = 3
x += 5 // ERROR: Left side of mutating operator isn't mutable: 'x' is a 'let' contstantAnd, at the top of the playground window, you see a warning of "The playground could not continue running because the playground source did not compile successfully".Problem though is I'm getting that warning when the code is valid. Not all the time though. At which point I close and re-open the playground and the issue sometimes goes away or persists. Sometimes I re-write the small code snippet and then it behaves.I'm thus finding it difficult to narrow down the cause, but it seems like playgrounds are ending up in a bad state; thinking the code isn't complable and then producing that warning or crashing.I have tried both run modes (Automatically Run and Manually Run) and get the same issues either way.
Post not yet marked as solved
I'm unable to install macOS Mojave beta onto my non-production Mac since it's not yet supported (2012 Mac Pro). It lacks Metal support.Anyhow, I'm curious as to the 'last to support 32-bits without compromise' statement Apple has made regarding macOS High Sierra (10.13).Are folks finding that 32-bit apps under Mojave are peforming more poorly? Or do they tend to crash? Or perhaps some features do not work?I will be testing specific software titles later, but wanted a high-level overview on what others are finding. Thank you.
Reviving an app I wrote a while back to Swift. When my iPhone X and iPad Air (both on iOS 11.3.1) are both connected to WiFi, the pair of apps work as expected. But when I disable WiFi on one or both, they never connect, even though Bluetooth is enabled.I have set the appropriate delegates and implemented browser:didNotStartBrowsing: as well as advertiser:didNotStartAdvertisingPeer: (former API in the main app on the iPhone; latter API in the second app on the iPad). But they are never called.I tried turning off Bluetooth, then back on, but no luck.Have others been able to use MCNearbyServiceBrowser and correlating APIs in a Bluetooth-only environment?
Post not yet marked as solved
The following code (in a playground) or even if in a project will ultimately fail to work.let theFormatter = MeasurementFormatter()
theFormatter.locale = Locale(identifier: "en_US")
theFormatter.unitStyle = .medium
theFormatter.numberFormatter.maximumFractionDigits = 2
let theSpeed = Measurement(value: 30, unit: UnitSpeed.milesPerHour)
theFormatter.string(from: theSpeed)
theFormatter.numberFormatter.maximumFractionDigits = 3
theFormatter.string(from: theSpeed)Basically, it appears that once you have an instance of MeasurementFormatter, and set 'maximumFractionDigits' on its internal number formatter, that setting will be used for all future formatting. Executing the above once may work, but adjusting the values of fraction digits thereafter doesn't change any output.i.e. attempting to set 'maximumFractionDigits' to something else later is ultimately ignored. It's as if the formatter is lazily building its number formatter and keeping the original instance as-is.Workaround is to assign a brand new number formatter instance. As my apps only use three different values for fraction digits (0, 1 and 2), I plan on just holding on to three pre-built formatters and assigning them to the measurement formatter as needed.
Post not yet marked as solved
Xcode 9.3Seeing a very odd issue with code coverage. I have two unit tests which ultimately test every branch in the following init function (put breakpoints to double-check that). Yet code coverage is putting red in the gutter along with a zero next to the lines in the if-blocks.Build is debug and code coverage turned on. I have not seeing the issue in other classes.init(data aData: Data?) { // Function called 482 times during full unit test run
index = 0
let theLength : Int
if let theData = aData {
theLength = theData.count // Code coverage shows zero here and zone is colored red
data = theData
} else { // Code coverage shows 482 here (which cannot be since the if-block is reached 90%+)
theLength = 0
data = Data()
}
length = theLength
}Same exact thing happens for a simple test class. Unit test created two instances, one passing in a 2, the other 3. Breakpoints prove both are hit, yet code coverage not reflecting that:class IIFoo {
let s : String
init(x anX: Int) { // Code coverage shows 2 here
if anX % 2 == 0 {
s = "even" // Shows 0 here and zone is colored red
} else { // Shows 2 here, zone is red and shows some diagonal lines in the coverage count area.
s = "odd"
}
}
}
Post not yet marked as solved
Trying to submit my first tvOS app (which uses Game Center). Very frustrating. When uploading my binary which verified a-ok, I got this issue:Missing Game Center Content - The GKGameCenterContent.plist file in 'Payload/Konane.app' does not contain a Dashboard image.So I added a Dashboard image to my image assets (even though it's an optional image as documented here: https://developer.apple.com/tvos/human-interface-guidelines/icons-and-images/game-center-images/But simply adding that image wasn't good enough. It demands that I reference it in the GKGameCenterContent.plist file. I had to create that file to reference leaderboard images. Thankfully there were posts on how to construct it. But I cannot find any documentation anywhere on what key-values are expected to reference a dashboard image.So I guessed... hmm let's try a key of "GKDashboard" (an array) with a single dictionary. In the dictionary, a key of "name" and value of "Dashboard". The value being the name of the asset. And that amazingly worked.Maybe there's a bug in the submission logic that pre-proccesses apps? Or, I got insanely lucky that such a made-up entry in that plist file is what Apple needed.Still would love to see an official resource on this plist and all valid key-values that can be put into it.
Post not yet marked as solved
My game started out as being for iPhone only. It has since been updated to be a universal app for iPad as well. I have noticed though that when playing, it will not submit achievements or update scores. Even though the same exact code runs (no conditional compilation).I blew it off at the time assuming that perhaps Game Center was down. I've just wrapped up development of a tvOS version of the game which shares the same app identifier. It works with Game Center as well, but the same issue happens; no achievements are being submitted and scores not updated. If I then play the game on my iPhone, it updates things as expected.I looked in itunes.connect.com to see if there were any device-specific settings, but cannot find any.Anyone else seeing this?
I'm trying to get Xcode 9.2 to wirelessly connect to my 4th gen Apple TV in order to install an app for testing.Side note: recent surgery leaves me with restrictions, so I cannot connect the Apple TV directly to my computer for a while.On the Apple TV, I went to the Remotes and Devices section and brought up the Devices window on in Xcode on my iMac Pro. The iMac is connected via both a wired connection (cable modem) and I turned on WiFi as well (on the same exact home network as the Apple TV). When attempting to add a new Device in Xcode, I see "Family Room" show up in the list (the name of our Apple TV), but a secondary message under it says "This device has been ignored in the Devices panel.". Searches on that phrase have come up empty.Also, the 'Next' button on the Devices 'Add Device' panel is disabled and an image says to select 'Trust' on the iOS device to continue. Alas, no such dialog/alert showed up on the Apple TV allowing one to pick 'Trust'. Also suspicious that the instructions mentioned 'iOS' instead of 'tvOS'.Finally, I was tempted to unpair the Apple TV but was faced with a strong warning message, so ultimately canceled. I didn't want to leave things such that the Apple TV would no longer commicate at all with my computer.Anyone else run into this? Thanks for any tips.