Post

Replies

Boosts

Views

Activity

Reply to Playground can't find symbols in swift private frameworks
Having this problem in Xcode 12 using a playground that used to work in Xcode 11 and 10. Trying to import a class in a framework from the same workspace. Playground compiles fine but then we get "error: Couldn't lookup symbols". Why can't Apple make Playgrounds "just work"? How about giving us a way to explicitly link certain frameworks to the playground so it never has this problem...?
Dec ’20
Reply to Custom UIWindow subclass with UIWindowScene
There is another trick you can use. First you make a dummy class that conforms to UIWindowSceneDelegate: swift open class MyWindowSceneDelegate: NSObject & UIWindowSceneDelegate {} Since all the requirements of UIWindowSceneDelegate are optional, the compiler will be happy. Afterwards you can do this: swift open class MyRealWindowSceneDelegate: MyWindowSceneDelegate { @objc var window: MyCustomUIWindowSubclass } At runtime when window is resolved, it will be of type MyCustomUIWindowSubclass.
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to App crashes, but only on iOS 14, and only if installed via MDM
Upon further investigation I noticed a Jetsam event around this crash implicating the app's process in being terminated due to using too much memory (2GB!) (see report below). Using up all the memory could only be possible if we have an infinite loop, and I also found several similar crash reports, with EXC_BAD_ACCESS and KERN_INVALID_ADDRESS or KERN_PROTECTION_FAILURE with Segmentation Fault 11 and Code 0xb, that indicate this could be caused by an infinite loop. So, what could cause an infinite loop, but only for MDM installs? I found another thread on this forum (link here) where someone had incurred an infinite loop due to following this code example from WWDC 2013 (link here) where an MDM manager class sets up an observer on NSUserDefaultsDidChangeNotification. Their infinite loop was due to someone putting a write call to UserDefaults in the target method of that observer. >.< So I checked and, sure enough, we have a write call to UserDefaults in the target method of the observer on NSUserDefaultsDidChangeNotification in our MDM manager. It was wrapped with an ivar to prevent the recursion, but it was not a perfect solution obviously. Something about how our iOS 14 build is optimized or the timing of when the method gets called on those builds triggers the recursion, which doesn't happen in iOS 15. In any event... the fix would be to not write to UserDefaults in that method if the change we want to make in UserDefaults already exists. So we're trying that, will reply here if it worked. { "uuid" : "1b20964b-84fa-329a-b8d0-7ad5df6f42ce", "states" : [ "frontmost" ], "killDelta" : 5005, "genCount" : 0, "age" : 73179629, "purgeable" : 0, "fds" : 50, "coalition" : 1975, "rpages" : 196608, "priority" : 10, "reason" : "per-process-limit", "physicalPages" : { "internal" : [ 135870, 60638 ] }, "pid" : 21668, "cpuTime" : 1.3859840000000001, "name" : "REDACTED", "lifetimeMax" : 196608 },
Nov ’21
Reply to App crashes, but only on iOS 14, and only if installed via MDM
Nevermind, it has nothing to do with the hypothesized infinite loop that I mentioned in the prior post. We ruled it out by disabling our MDM code on first launch and adding a bunch of os_log calls at the start of the app. None of the os_log calls get called, meaning AppDelegate never gets initialized. So we're back to square one trying to figure out this mystery.
Nov ’21
Reply to Not able to install enterprise build in iOS 15 beta version
On iOS 15, when our app runs we see: AMFI: constraint violation /private/var/containers/Bundle/Application/272392ED-BF0A-48A0-8FB1-4FB707B234A0/REDACTED.app/Frameworks/SwiftProtobuf.framework/SwiftProtobuf has entitlements but is not a main binary for all our .frameworks. I checked and all our .frameworks have an empty plist as their entitlements, even though none of them specify an entitlements plist in anywhere in Xcode. Pray tell why these empty plists are being added Eskimo? And also, why does it trigger a violation in AMFI?
Nov ’21
Reply to App crashes, but only on iOS 14, and only if installed via MDM
Also see this in the logs: -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: Sending EndInterruption to com.REDACTED.REDACTED with pid '49,178' because client moved to ForegroundRunning and is not allowed to play in the background. Could this be related? I googled "because client moved to ForegroundRunning and is not allowed to play in the background" and see some similar crash reports from people indicating an intermittent, device-only crash that only affects certain users, such as this post.
Nov ’21
Reply to customizable/resizable sheets in SwiftUI?
@Frameworks Engineer wrote: If the system medium detent isn't sufficient for your use case, you may need to continue to use your own card/sheet implementation. < < < Problem is, the .sheet modifier doesn't give you the medium detent. It only gives the large detent. (Always covers the whole screen.) Apple... if you're listening... please add more flexibility to these SwiftUI APIs. Like... why are you adding functionality that's only available to UIKit? Are you deliberately trying to make adoption go as slow as possible while we reinvent every wheel?
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’22