Post

Replies

Boosts

Views

Activity

PushToTalk - On App termination
How to programmatically leave a channel when an app is forced closed? Currently when a user closes the app, the channel remains active and can still talk via the status bar. However i imagine if a user force closes the app, they no longer want to talk. I tried implementing this via  func applicationWillTerminate(_ application: UIApplication) { // leave channel code } but it doesn't seem to work
3
0
1.5k
Jan ’23
How to know when user upgrades/downgraded/crossgrades their subscription on the client
Hey, in our app we show post-purchase flow when a user purchases a subscription and its appearance should depend on the type of purchase: upgrade, downgrade or crossgrade. I found a way how to get this type on the backend side but can not figure out how to get this within the app. I see that Transaction has isUpgraded property but it is always false even if I move from a lower service plan to a higher one. So, I have two questions: Is this actually possible to know on the client when the user upgrades, downgrades or crossgrades? If yes, then how? Thanks
4
1
2.0k
Jan ’23
How to configure website icon on payment sheet using Apple Pay JS API
According to the documentation provided in https://developer.apple.com/design/human-interface-guidelines/technologies/apple-pay/checkout-and-payment/#customize-the-payment-sheet under Displaying a website icon section, we can use icon configured for bookmarks or URL fields to display on the payment sheet but if the developer need to explicitly configure the icon using Apple Pay JS or any other way to display in summary view on payment sheet.
1
1
862
Jan ’23
Problem loading icon for ApplicationToken with Label
After the Screen Time permissions have been provided by the user, when I create a label with the user's selected ApplicationToken or CategoryToken, it's often (not always!) show like this: I instantiate the label like this, where app is an ApplicationToken or CategoryToken: Label(app)     .labelStyle(.iconOnly) After the app is killed and reloaded, the icons show up fine. Any suggestions on how to fix this? Is this an issue with the Screen Time API, or am I instantiating the label in the wrong way?
9
1
1.6k
Jan ’23
ClockKit Complications not working with Xcode 14 single-target watchOS app
I’ve created a single-target watchOS app in Xcode 14, but I can’t seem to get ClockKit complications working. I’ve added a CLKComplicationDataSource class to my watch target, and in the Info pane for my target I have set the CLKComplicationPrincipalClass key to MODULE-NAME.ComplicationController I haven’t yet added Complication placeholder images to my Assets.xcassets, but as far as I am aware, that shouldn’t be a problem while I am still testing. However, when I run it on a watchOS simulator, the complications never show up on the watch complications list when adding a complication. All of the tutorials I can find for ClockKit complications reference older two-target WatchKit apps. Do the newer single target apps no longer support ClockKit? If so, how can I make a two-target WatchKit app with Xcode 14? Unfortunately I cannot use WidgetKit for my complications because I need to support watchOS 7 at least, and WidgetKit only supports watchOS 9+ Thanks for your help
3
1
1.9k
Jan ’23
Weird NSCocoaErrorDomain errow when trying to autorize Screen Time API
Hello, we have rare case of AuthorizationCenter.shared.requestAuthorization(for: .individual) failing to autorize user on real device - iPhone XR (iOS 16.1.2). It does not throw the standard FamilyControlsError which we are handling, but NSCocoaErrorDomain. This is the entire po description: Error Domain=NSCocoaErrorDomain Code=4864 "The given data was not a valid property list." UserInfo={NSCodingPath=(), NSDebugDescription=The given data was not a valid property list., NSUnderlyingError=0x283af4d80 {Error Domain=NSCocoaErrorDomain Code=3840 "Cannot parse a NULL or zero-length data" UserInfo={NSDebugDescription=Cannot parse a NULL or zero-length data}}} The localized one says: "The data couldn’t be read because it isn’t in the correct format." This sounds like some error deep in iOS. The testing device has Apple ID logged in and uses passcode. Anything we can do on our end to solve this issue?
3
0
1.6k
Jan ’23
WeatherKit REST API new columns for CurrentWeather
My pipeline broke today as new fields were added for the current weather dataset: cloudCoverLowAltPct cloudCoverMidAltPct cloudCoverHighAltPct I presumed new fields would only be released in a new version of the API? Is there any way to use a specific version of the API that will not be subject to change? The current weather REST API docs are here, which don't include these fields: https://developer.apple.com/documentation/weatherkitrestapi/currentweather/currentweatherdata
6
1
1.1k
Jan ’23
apple pencil won’t connect
hey! i have an ipad pro 11’ 2018, and everything was working fine until one day i wasn’t able to connect my apple pencil 2 to my ipad. the pencil itself gets detected it just won’t connect with my ipad. i already tried restarting, unpairing (even since i wasn’t able to pair it) and even restoring my ipad. does anyone have a solution for this?
1
1
775
Jan ’23
Runtime error when using StoreKit 2
When performing StoreKit 2 operations in my Mac app, even very simple ones like AppStore.sync() a small but steady percentage of users experiences the following error: systemError(Error Domain=NSCocoaErrorDomain Code=4097 \"connection to service named com.apple.storekitagent\" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}) Rebooting or re-downloading the App from the Mac App Store, as well as signing out and in again on the Mac App Store does not solve the issue. Strangely enough all of the affected users I'm aware of were initially able to perform In-App purchases via the said app. Without any updates or anything else however suddenly after a restart of the app the above error gets thrown by the system. As I have not found any way to solve this issue yet and the said customers are consequently left without service even though they are paying customers, I am desperate to find help with this issue. Given the simplicity of the AppStore.sync() method for example I can't imagine the solution to lie in code, but I might of course be wrong. Thank you, Bastian
2
0
1.2k
Jan ’23
Illegal instruction in std::remainder (libsystem_m.dylib) when floating point exceptions enabled on M1 mac
Call to std::remainder(double(411.0), int(365)); results in a crash due to a nan in libsystem_m.dylib. MCVE program is provided + lldb backtrace and system report. $ clang++ -g -arch arm64 -std=c++20 main.cpp -o test $ ./test ori_fpcr=0, new_fpcr=1792 std::fmod(simTimeInDays, numDays) = 46 Illegal instruction: 4 main.cpp #include <cassert> #include <cfenv> #include <cmath> #include <iostream> #if !defined(__arm64__) || !defined(__APPLE__) # error "Meant to be run on arm64 apple" #endif inline int feenableexcept(unsigned int excepts) { static fenv_t fenv; if (std::fegetenv(&fenv) != 0) { return -1; } const unsigned long long old_fpcr = fenv.__fpcr; const unsigned int old_excepts = (old_fpcr >> 8u) & unsigned(FE_ALL_EXCEPT); // Check the bits passed are valid, and bit shift them const unsigned int new_excepts = excepts & unsigned(FE_ALL_EXCEPT); const unsigned long long new_fpcr = new_excepts << 8u; // Set the new bits fenv.__fpcr = fenv.__fpcr | new_fpcr; return (std::fesetenv(&fenv) != 0) ? -1 : static_cast<int>(old_excepts); } int main([[maybe_unused]] int argc, [[maybe_unused]] const char** argv) { constexpr unsigned int flags = FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW; static_assert(flags == 7); constexpr uint32_t fpcr_flags_shifted = flags << 8; constexpr uint32_t fpcr_flags = (__fpcr_trap_divbyzero | __fpcr_trap_invalid | __fpcr_trap_overflow); static_assert(fpcr_flags_shifted == fpcr_flags); static_assert(fpcr_flags_shifted == 1792); uint32_t ori_fpcr = __builtin_arm_rsr("fpcr"); feenableexcept(flags); uint32_t new_fpcr = __builtin_arm_rsr("fpcr"); // std::cout << "(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) = " << flags << '\n'; // std::cout << "((FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) << 8) = " << fpcr_flags_shifted << '\n'; // std::cout << "(__fpcr_trap_divbyzero | __fpcr_trap_invalid | __fpcr_trap_overflow) = " << fpcr_flags << '\n'; std::cout << "ori_fpcr=" << ori_fpcr << ", new_fpcr=" << new_fpcr << '\n'; const double simTimeInDays = 411.0; const int numDays = 365; // This is fine std::cout << "std::fmod(simTimeInDays, numDays) = " << std::fmod(simTimeInDays, numDays) << '\n'; // This isn't std::cout << "std::fmod(simTimeInDays, numDays) = " << std::remainder(simTimeInDays, numDays) << '\n'; return 0; } backtrace: see attachment lldb_backtrace.txt $ system_profiler SPSoftwareDataType SPHardwareDataType Software: System Software Overview: System Version: macOS 13.2 (22D49) Kernel Version: Darwin 22.3.0 Boot Volume: Macintosh HD Boot Mode: Normal Secure Virtual Memory: Enabled System Integrity Protection: Enabled Time since boot: 7 hours, 58 minutes Hardware: Hardware Overview: Model Name: MacBook Pro Model Identifier: MacBookPro18,2 Model Number: Z14V000NBFN/A Chip: Apple M1 Max Total Number of Cores: 10 (8 performance and 2 efficiency) Memory: 64 GB System Firmware Version: 8419.80.7 OS Loader Version: 8419.80.7 Activation Lock Status: Enabled $ otool -L test test: /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0 $ clang++ --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
1
0
931
Jan ’23
Using URLCache subclasses with URLSession
I have an app which uses URLSession-based networking and URLCache for storing network requests on disk. I noticed that when the storage size of URLCache reaches the diskCapacity, the eviction strategy seems to be to remove all entries, which is a problem in my use case. So I decided to write an URLCache subclass which would provide a custom storage for cached responses and which would implement LRU eviction strategy with better control. As URLCache's documentation states, subclassing for this purpose should be supported: The URLCache class is meant to be used as-is, but you can subclass it when you have specific needs. For example, you might want to screen which responses are cached, or reimplement the storage mechanism for security or other reasons. However, I ran into problems with trying to use this new URLCache subclass with URLSession networking. I have a test resource which I fetch using HTTP GET. The response headers contain: Cache-Control: public, max-age=30 Etag: &lt;some-value&gt; When using the standard, non-subclassed URLCache, the first request loads the data from network as expected (verified with HTTP proxy). The second request doesn't go to the network, if done within first 30 seconds, as expected. Subsequent requests after 30 seconds cause conditional GETs with Etag, as expected. When using a URLCache subclass, all requests load the data from network - max-age doesn't seem to matter, and no conditional GETs are made. It seems that the URLCache does something special to the CachedURLResponse instances after they're loaded from its internal storage, and this something affects how URLSession handles the HTTP caching logic. What am I missing here? I've written a very minimal URLCache implementation to demonstrate this problem. This class stores and loads CachedURLResponse instances using NSKeyedArchiver / NSKeyedUnarchiver, and it supports only zero or one response. Note that there are no calls to super - this is by design, since I want to use my own storage. Here's the implementation: class CustomURLCache: URLCache { let cachedResponseFileURL = URL(filePath: NSTemporaryDirectory().appending("entry.data")) // MARK: Internal storage func read() -&gt; CachedURLResponse? { guard let data = try? Data(contentsOf: cachedResponseFileURL) else { return nil } return try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! CachedURLResponse } func store(_ cachedResponse: CachedURLResponse) { try! (try! NSKeyedArchiver.archivedData(withRootObject: cachedResponse, requiringSecureCoding: false)).write(to: cachedResponseFileURL) } // MARK: URLCache Overrides override func cachedResponse(for request: URLRequest) -&gt; CachedURLResponse? { read() } override func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -&gt; Void) { guard let response = read() else { completionHandler(nil) return } completionHandler(response) } override func storeCachedResponse(_ cachedResponse: CachedURLResponse, for request: URLRequest) { store(cachedResponse) } override func storeCachedResponse(_ cachedResponse: CachedURLResponse, for dataTask: URLSessionDataTask) { store(cachedResponse) } } My test case: func test() { let useEvictingCache = false let config = URLSessionConfiguration.default if useEvictingCache { config.urlCache = CustomURLCache() } else { config.urlCache = URLCache(memoryCapacity: 0, diskCapacity: 1024 * 1024 * 100) } self.urlSession = URLSession(configuration: config) let url = URL(string: "https://example.com/my-test-resource")! self.urlSession?.dataTask(with: URLRequest(url: url), completionHandler: { data, response, error in if let data { print("GOT DATA with \(data.count) bytes") } else if let error { print("GOT ERROR \(error)") } }).resume() }
4
0
1.7k
Feb ’23
presentCodeRedemptionSheet issue
Hi I'm using presentCodeRedemptionSheet() method to display a sheet that enables users to redeem subscription offer codes. When calling the SKPaymentQueue.default().presentCodeRedemptionSheet() method on real app store app it will present redemption sheet and after entering the offer code in it is displaying screen where Cancel and Redeem buttons do not work. As seen in the attached picture. What could be the reason for this and what solutions can be found to solve the problem? Please someone help it is really frustrating. Environment: iOS 16.3
8
2
2.2k
Feb ’23
Where is the correct and official contact window for Apple VAS?
Hi everyone, I work in a company with NFC-enabled reader manufacture. As for the title, I have searched for it for a lone time. Not NFC Certificate Request, it's for issuing passes. I inquired about MFI and the reply was that NFC is not within the scope of MFI. I have asked the local Apple team for help and they have no contact information for other teams and it is not clear which team to contact. My questions are below. Where is the correct and official contact window for Apple VAS? Is my post posted in the correct forum? If not, can you provide the correct place to ask? If possible, I hope to know the conditions for obtaining VAS authorization. Thanks a lot. Ken.
3
0
1.3k
Feb ’23
Suddenly receiving error 21002 from verifyReceipt endpoint for sandbox receipt
We started getting error code 21002 from the verifyReceipt endpoint today for any receipt passed to it: {     "status": 21002 } I have created a new sandbox tester, and cleared and reinstalled the application before attempting the purchase. I'm seeing this response through RevenueCat's receipt validation tool (https://www.revenuecat.com/app-store-receipt-validation/) and from a direct cURL command: curl --location --request POST 'https://sandbox.itunes.apple.com/verifyReceipt' \ --header 'content-type: application/json' \ --data-raw '{     "receipt-data":"{RECEIPT_DATA}",     "password":"{SECRET}",     "exclude-old-transactions":"false" }' This was working as of yesterday, but seems to be failing for anyone who has tried today. Has anyone else run into issues with this?
28
7
8.4k
Feb ’23
iOS 16 Crash _os_unfair_lock_recursive_abort
I found a lot of crashes on iOS 16,the detail infomation: Exception Type:  EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000020f3d108c Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [18104] Triggered by Thread:  0 Thread 0 name: Thread 0 Crashed: 0   libsystem_platform.dylib      0x000000020f3d108c _os_unfair_lock_recursive_abort + 36 (lock.c:508) 1   libsystem_platform.dylib      0x000000020f3cb898 _os_unfair_lock_lock_slow + 280 (lock.c:567) 2   libobjc.A.dylib               0x00000001ba6939b4 lookUpImpOrForward + 156 (lock_private.h:716) 3   libobjc.A.dylib               0x00000001ba68e0c4 _objc_msgSend_uncached + 68 (:-1) 4   myApp                        0x00000001005e8d04 post_crash_callback + 64 (XBPLCrashManager.m:122) 5   myApp                        0x0000000101453744 signal_handler_callback + 184 (PLCrashReporter.m:237) 6   myApp                        0x000000010144fc6c internal_callback_iterator(int, __siginfo*, __darwin_ucontext*, void*) + 140 (PLCrashSignalHandler.mm:0) 7   myApp                        0x000000010144fbc0 plcrash_signal_handler + 24 (PLCrashSignalHandler.mm:201) 8   libsystem_platform.dylib      0x000000020f3cca90 _sigtramp + 56 (sigtramp.c:116) 9   libsystem_kernel.dylib        0x00000001fed74bf0 abort_with_payload_wrapper_internal + 104 (terminate_with_reason.c:102) 10  libsystem_kernel.dylib        0x00000001fed74b88 abort_with_reason + 32 (terminate_with_reason.c:116) 11  libobjc.A.dylib               0x00000001ba6bfa5c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 116 (objc-errors.mm:199) 12  libobjc.A.dylib               0x00000001ba6bf9e8 _objc_fatal(char const*, ...) + 32 (objc-errors.mm:215) 13  libobjc.A.dylib               0x00000001ba6bf978 cache_t::bad_cache(objc_object*, objc_selector*) + 228 (objc-cache.mm:829) 14  libobjc.A.dylib               0x00000001ba6944f0 cache_t::insert(objc_selector*, void (*)(), objc_object*) + 296 (objc-cache.mm:901) 15  libobjc.A.dylib               0x00000001ba693ba8 lookUpImpOrForward + 656 (objc-runtime-new.mm:6739) 16  libobjc.A.dylib               0x00000001ba68e0c4 _objc_msgSend_uncached + 68 (:-1) 17  UIKitCore                     0x00000001c36f9ad8 -[UIViewController initWithNibName:bundle:] + 216 (UIViewController.m:2671) 18  myApp                        0x0000000100d78088 -[myUIBaseViewController init] + 44 (myUIBaseViewController.m:60) 19  myApp                        0x000000010031f744 -[XBSCLaunchManager makeTabBarViewController] + 2600 (XBSCLaunchManager.m:432) 20  myApp                        0x000000010032022c -[XBSCLaunchManager showTabbarViewController] + 292 (XBSCLaunchManager.m:569) 21  libdispatch.dylib             0x00000001c89ecfdc _dispatch_client_callout + 20 (object.m:560) 22  libdispatch.dylib             0x00000001c89f046c _dispatch_continuation_pop + 504 (inline_internal.h:2632) 23  libdispatch.dylib             0x00000001c8a03a58 _dispatch_source_invoke + 1588 (source.c:596) 24  libdispatch.dylib             0x00000001c89fb748 _dispatch_main_queue_drain + 756 (inline_internal.h:0) 25  libdispatch.dylib             0x00000001c89fb444 _dispatch_main_queue_callback_4CF + 44 (queue.c:7887) 26  CoreFoundation                0x00000001c146a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780) 27  CoreFoundation                0x00000001c144c03c __CFRunLoopRun + 2036 (CFRunLoop.c:3147) 28  CoreFoundation                0x00000001c1450ec0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 29  GraphicsServices              0x00000001fb4a7368 GSEventRunModal + 164 (GSEvent.c:2196) 30  UIKitCore                     0x00000001c394686c -[UIApplication _run] + 888 (UIApplication.m:3754) 31  UIKitCore                     0x00000001c39464d0 UIApplicationMain + 340 (UIApplication.m:5344) 32  myApp                        0x0000000100330b5c main + 88 (main.m:14) 33  dyld                          0x00000001dfc72960 start + 2528 (dyldMain.cpp:1170)  Request for help on advice prevention and fix for this. Thanks
3
1
2.2k
Feb ’23
Strong Password Autofill not allow custom password
Hi, we are facing on a strange behaviour since iOS 16. In a registration view, we have two text field to insert password (password textfield and confirm password text field). Suggest strong password is abilitate (from iCloud... password & keychain). When user tap on password text field, can choose between strong password or text custom password. If user choose custom password, can text his own password as usually. But when he tap the second text field (confirm password) Apple fill in automatic both text field, cleaning the first text field... So user entry in a loop where he text password and when go next, previous textfield be cleaned and both text field filled with a new suggestion. Searching on the web we don't find any solution to it. Also because we try just to set text fields as .password or .newPassword. But this behaviour is always the same. Maybe is it a bug of iOS 16? How we can allow user to chose a custom password if the system fill always in automatic the password text fields, every time he tap on them?
6
3
3.0k
Feb ’23
StoreKit 2 - Is it necessary to finish unverified transactions?
The sample code provided in https://developer.apple.com/wwdc21/10114 doesn't appear to call finish() on unverified transactions, and I haven't been able to find any documentation regarding what to do with unfinished transactions. However, Apple has always emphasized the importance of finishing transactions, and since a transaction object is provided even with the unverified state, I'd love some guidance!
2
0
1.8k
Feb ’23
I would like to create several schedules for an activity can I do that
currently when I try to set several schedules to the same activity the latest schedule I set is the only one I understand I can have only 1 schedule for activity. ? I thought about setting a new schedule on the intervalDidEnd but, I get no interval did start if the current time is in the middle of the interval I set For example, now it is 15:00, and my previous interval started at 14:00 and ends at 16:00 but the user sets a new interval from 14:30 - 16:40 I call the deviceActivityCenter.stopMonitoring([someActivityName]) and get noIntervalDidEnd event Then I set the new interval successfully with deviceActivityCenter.startMonitoring(someActivityName, during: deviceActivitySchedule) and get no intervalDidStartEvent So how can I achieve several intervals? If I had gotten the events of the start and end it would be possible Thanks for the help
3
0
1.1k
Feb ’23
NFCTagReaderSession.PollingOption.pace fails with "Missing required entitlement" error
Hi, I'm developing an app that reads the NFC tags. So far so good, everything worked as expected, the app reads the passports and the IDs, until we encountered the french ID issued after March 2021. My app has the following entitlements: <dict> <key>com.apple.developer.nfc.readersession.formats</key> <array> <string>TAG</string> </array> </dict> And this additional entries in the .plist: <key>NFCReaderUsageDescription</key> <string>NFC usage to scan ID chip</string> ... <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>A0000002471001</string> <string>A0000002472001</string> <string>00000000000000</string> </array> According to an article which I cannot link on this forum because the domain is not permitted, iOS started supporting this specific ID from version 16. When I look at the docs, I can see the .pace polling mode was added. I tried specifying this additional polling mode in my app like so: var pollingOptions: NFCTagReaderSession.PollingOption = [.iso14443] if #available(iOS 16, *) { pollingOptions.insert(.pace) } self.session = NFCTagReaderSession(pollingOption: pollingOptions, delegate: self, queue: nil) But when I try to start the session it gets instantly invalidated with this message: Missing required entitlement. I'm pretty confident the message is misleading and something else is missing somewhere, my bet would be on the .plist entry com.apple.developer.nfc.readersession.iso7816.select-identifiers missing one of the cryptic numbers, but I have no idea where this can be taken from. How do I implement this .pace polling mode, can someone give me some guidance?
1
0
971
Feb ’23