Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.

Post

Replies

Boosts

Views

Activity

Reference example of AppTest server-side implementation
Hi, We have a multi-platform application that requires integrity attestation before the backend will enable supporting services (fairly common scenario). I've read the documentation for DeviceCheck and AppAttest, as well as SafetyNet on the Android side. The Android documentation includes lots of examples of use, including server-side (though oddly in C# and Javascript... which I don't see as being server-side languages, but... oh, well). Anyway, maybe there's a server-side example of using an application attestation on the server when validating a client, as well as validating individual requests with assertions, but I've not been able to find it. It seems like a relatively important bit of functionality to ensure that apps aren't being compromised, while at the same time requiring a correct implementation... Why not give a reference implementation as a starting point to make sure developers are on the right path? Can anyone point me at an example as a Gist, etc? Thanks.
4
1
3.1k
Aug ’21
How to bypass screen time and access adult websites
I believe I deserve the bounty hunter price for this one. Procedure on how to bypass screen time and access adult websites. This method will work on iPad, iPhone, MacBook Pro, iMac, MiniMac Line 1 - Turn on screen time Line 2 - Set a passcode  Line 3 iPhone/iPad - Go to Content & Privacy Restrictions > Content Restrictions > Web Content > Limit Adult Websites Line 3 -- iMac/MacBookPro/miniSystem Preferences > Screen Time > Content Restrictions > Web Content > Limit Adult Websites By completing lines 1-3 the device won't be able to access any adult websites on Safari ONLY. The way to bypass this is to download google chrome on the device, after the download is complete navigate to the search engine. Line 4 - Search for "*******", or  "xnxx", or Xvids on google chrome -- if you try to enter the websites it won't allow you on the iPad and iPhone. But it will allow you to enter on iMac, MacBook Pro and MiniMac (If you toggle between Videos and Images on google search you can see explicit content which or not blocked). Which proves that the Screen Time does not work on Chrome, if you try Safari it won't allow you to enter or see any adult content. To bypass on the iPhone and iPad Try Line 5 Line 5 - To bypass on the iPhone and iPad search on chrome "xnxx Japan", "xnxx China", "xnxx India", "xnxx arabic" and toggle to the video or image tab.  The goal here is to find a video or image that will allow to enter the website base on their native language of upload. This is not allow you to enter if it is in English or if it was upload in America.  To show that this works on the iPhone or iPad redo 1-Line 3 and turn Screen Time on and Blah Blah Blah Line 6 - Go to chrome search for "xnxx Japan" and toggle to the video tab  Line 7 - Click on the first video (which was uploaded Jun 15 2018) if it does not let you in restart the divide and try again and it should work. Try second Video. Try "*******".                                                                !!!!SCREEN TIME IS BROKEN!!!! Nick from Apple Product Security told me I and quote  " Features like Screen Time are designed to provide parents with the tools to understand and manage their children’s device usage. Screen Time is not intended to protect a device against manipulation." Which makes SCREEN TIME a complete JOOKE Fix the bug and pay me for the bounty!  Ps... Here is a Solution on How to prevent Children from watch ****  Line 8 - Go to Content & Privacy Restrictions > Content Restrictions > Web Content > Limit Adult Websites Line 9 - Under Never Allow click on it and type the physical URL address  https://www.xnxx.com https://www.*******.com Blah Blah Blah Parental Advisory Explicit Content
1
0
6.0k
Aug ’21
Swift Process with Psuedo Terminal (PTY)
Hi! I'm looking for some insight and guidance on using the Foundation.Process type with a PTY (Psuedo Terminal) so that the subprocess can accept input and behave as if it was running via a terminal. The reason for needing a PTY is that for programs like ssh or in my case (xcodes) which ask for user input including passwords, running these via Foundation.Process does not display the prompts to the user as the output is usually buffered (this works fine in the Xcode debugger console but when running via a real terminal that is buffered the prompts are never displayed in the terminal) Looking at other threads it seems like correct approach here is create a PTY and use the filehandles to attach to the Process. While I've got this to work to the point where prompts are now shown, I cant seem to figure out how to pass input back to the process as these are being controlled by the PTY. Here is my Process setup: let process = Process() // Setup the process with path, args, etc... // Setup the PTY handles var parentDescriptor: Int32 = 0 var childDescriptor: Int32 = 0 guard Darwin.openpty(&parentDescriptor, &childDescriptor, nil, nil, nil) != -1 else {   fatalError("Failed to spawn PTY") } parentHandle = FileHandle(fileDescriptor: parentDescriptor, closeOnDealloc: true) childHandle = FileHandle(fileDescriptor: childDescriptor, closeOnDealloc: true) process.standardInput = childHandle process.standardOutput = childHandle process.standardError = childHandle With this setup I then read the parent handle and output any result it gets (such as the input prompts): parentHandle?.readabilityHandler = { handle in   guard let line = String(data: handle.availableData, encoding: .utf8), !line.isEmpty else {     return   }   logger.notice("\(line)") } When process.run() is executed the program runs and I can see it asks for Apple ID: input in my terminal, however, when typing input into the terminal the process does not seem to react to this input. I've tried forwarding the FileHandle.standardInput: FileHandle.standardInput.readabilityHandler = { handle in   parentHandle?.write(handle.availableData) } But this doesn't seem to work either. What is the recommended way to setup a PTY with Foundation.Process for executing arbitrary programs and having them behave as if they were being run in a terminal context? Most of the resources I found online are about other languages and I'd like to stick with Foundation.Process vs. doing anything custom in C/C++ if possible as it just makes it easier to reason about / maintain. The resources for Swift on this topic are very lacking and I've checked out some open source projects that claim to do this but most require manually sending input to the PTY handle vs. accepting them from the user in a terminal. Any insight / help is very much appreciated!
9
0
2.9k
Aug ’21
How obtaining the Call Status without CallKit
iOS Deployment Target 12.0. I want to used 'CTCallCenter' from CoreTelephony , xcode told me 'CTCallCenter' was deprecated in iOS 10.0: Replaced by CXCallObserver from CallKit.framework. but china prohibited to use the CallKit.framework. i just want to obtaining the Call Status, no phone UI, no VoIP. so i want to know how can i do
1
0
660
Aug ’21
Universal link contains fragment
Hi, I'm having a problem about defining universal link. I have a link like: host/en/booking/#serviceApp/resetPassword. I added in AASA file bellow: "applinks": { "apps": [], "details": [ { "appID": "myAppId", "components": [ { "/": "/*/booking/*/resetPassword", "#": "serviceApp" } ] }, ] } } Is it correct? Because I tried to test but it did not work Thanks!
1
1
634
Sep ’21
Localized language not getting deleted
I'm trying to remove a few languages which is present as the localized language in my app (under language section) in iTunes connect but when I try to remove it, it allows me to remove but when I try to save these changes Apple is prompting me an error message "You have one or more errors on this page. • An error has occurred. Try again later." Can anyone, please let me know how can I remove a localized language?
2
0
1.1k
Sep ’21
New iOS String Initializer can't get correct localized String for specific locale
I tried to build LocalizedKeyString using String's new Initializer. String(localized: "hello",locale: locale) When I change the language setting of the device, everything works as expected. However, when I try to get the string in a specific language using the specified Locale, I can only ever get the string in .current. String(localized: "hello",locale: Locale(identifier: "zh-cn"))     func getString(locale:Locale) -> String{          String(localized: "hello",locale: locale)     } If you change the display language of the project (or the language setting of the device), the text in Text is always displayed correctly. Text(getString(locale:.current)) However, the code in onAppear print(getString(locale:Locale(identifier: "zh-cn"))) It only displays the same content as Text, but not the specified Chinese. Is it my fault that the new Initializer The understanding is not correct, or the bug of String init(localized keyAndValue: String.LocalizationValue, table: String? = nil, bundle: Bundle? = nil, locale: Locale = .current, comment: StaticString? = nil) FB number: FB9675845
7
0
3.5k
Oct ’21
UserDefaults not being saved in Simulator only
In Xcode 13, using the 14.5 and 15.0 simulators, when I use UserDefaults to save preferences for the user, the defaults seem to go away when the app quits (I am using the home button / app switcher / slide up gesture to quit the app in the simulator). This problem does not occur when using my actual devices (iPad and iPhone). [userDefaults synchronize] returns YES, however I am getting nil for the key I saved upon next launch. Note: I am using NSKeyedArchiver archivedDataWithRootObject with requiresSecureCoding set to YES for some keys, however the first key is not using NSKeyedArchiver and is also returning nil.
3
0
1.4k
Oct ’21
Mac Catalyst scene auto recreation
Hi, I have Mac catalyst app, that usually shows one window, but under some circumstances I open another one with different content (so it is multi-windowed app, but not in a way of opening several documents in instances of the same type of window). I did manage to setup SceneDelegate, open scenes etc., but I have still some problems. After app launch, old scenes are automatically recreated. Is there a way to stop it? I want to always start with main scene, and only open the second one from code. Is there a way to set size and position of a window before it is shown? I can do it by acquiring NSWindow from UIWindow and then using AppKit from another bundle. But this can only be done after the window appears on screen. As a result, user sees window "jump". When scene is being created (or maybe just recreated to restore previous session), window gets the same position it had before. Is there any way to control it? How this mechanism exactly works? Where are the previous positions stored and can they be modified? How a newly created scene gets its size and position?
4
0
1.6k
Oct ’21
Universal Links to multiple apps (iOS 15)
Hi! We have two apps, both use the Universal Links mechanism, apps should be opened when user read NFC tag. The tag content is a URL link to our domain. After updating to iOS 15, users faced the problem that they constantly see the application selection dialog when reading the nfc tag. How to fix it? Previously, the selection dialog was displayed once and the value was stored. Our aasa file on domain: { "applinks": { "apps": [], "details": [ { "appIDs": ["*.*.app1"], "paths": ["*"] }, { "appIDs": ["*.*.app2"], "paths": ["*"] } ] }, "appclips": { "apps": [ "*.*.app2.Clip" ] } }
1
0
1.1k
Oct ’21
TextKit2: Relation between NSRange and NSTextRange
The way NSTextView is built it's inevitable to use NSTextStorage with TextKit2, however the NSAttributedString uses NSRange vs the TextKit2 family uses NSTextRange for text location, etc. What I struggle with is the relation between these two. I didn't find a convenient translation between these two. Is NSAttributedStrint NSRange length=1 equal to NSTextRange offset 1? I think it's not (at least it's not necessarily true for every NSTextContentManager. So my question is, given a NSTextRange, what is the corresponding NSRange in NSTextContentStorage.attributedString
4
0
1.5k
Nov ’21
WatchKit sendMessage wakes up iPhone app
According to the docs, calling WatchKit's sendMessage on an Apple Watch app extension wakes up the corresponding iPhone app in the background. This enables the iPhone app to provide the Watch app with data it needs, even if the iPhone app is currently not in the foreground. Unfortunatelly, I cannot find much information about this process. I'd like to know the answer to these questions: Is there a special launchOptions key present when the iPhone app starts up in the background? According to these docs, an empty launchOptions indicates that the user started the app from the home screen - all other startup reasons have their own launchOptions key. However, when testing the wakeup, I get an empty launchOptions. Are there other options that can be used to detect that the iPhone app runs in the background? For example, I expected [UIScreen mainScreen] to be nil because in the background we do not have screens and windows, but there seems to be no difference in mainScreen in the background process. Are there any limits to the background process? For example, is there a limit in how long it can run? Is there a way I can debug such a background process in XCode? Can I tell XCode "wait until the app runs on the iPhone", such that the debugger gets attached as soon as the app runs?
1
0
1.1k
Nov ’21
CFNetwork crash in CFURLRequestSetMainDocumentURL
I have received two strange crash reports from an iPad11,7 running iPadOS 15.1 and an iPad11,2 running iPadOS 15.2. On both occasions, the crashed thread calls CFURLRequestSetMainDocumentURL, which in turn calls _dispatch_source_set_runloop_timer_4CF in libdispatch, after which the application crashes with SIGSEGV and SEGV_MAPERR. The crashed thread's call stack is displayed below. Full crash logs are attached as well. What could this be? Exception Type: SIGSEGV Exception Codes: SEGV_MAPERR at 0x21d Crashed Thread: 20 Thread 20 Crashed: 0 libdispatch.dylib 0x00000001829e1784 _dispatch_source_set_runloop_timer_4CF + 36 1 CFNetwork 0x00000001834fc824 CFURLRequestSetMainDocumentURL + 2240 2 CFNetwork 0x00000001836b89a8 _CFNetworkErrorGetLocalizedDescription + 693652 3 CFNetwork 0x00000001834fdb1c CFURLRequestSetMainDocumentURL + 7096 4 CFNetwork 0x00000001834f3c34 CFURLRequestSetURL + 9668 5 libdispatch.dylib 0x00000001829ca914 _dispatch_call_block_and_release + 28 6 libdispatch.dylib 0x00000001829cc660 _dispatch_client_callout + 16 7 libdispatch.dylib 0x00000001829d3de4 _dispatch_lane_serial_drain + 668 8 libdispatch.dylib 0x00000001829d498c _dispatch_lane_invoke + 440 9 libdispatch.dylib 0x00000001829d5c74 _dispatch_workloop_invoke + 1792 10 libdispatch.dylib 0x00000001829df1a8 _dispatch_workloop_worker_thread + 652 11 libsystem_pthread.dylib 0x00000001f1eea0f4 _pthread_wqthread + 284 12 libsystem_pthread.dylib 0x00000001f1ee9e94 start_wqthread + 4 second_crashlog.txt report-2517628380750009999-e4d7ea06-6f22-4b7e-b129-045599e1dee5.txt
9
1
4k
Dec ’21
Mac Catalyst WKWebview cannot click twice on http dropdown on macOS.
If we click on a simple html dropdown list on a WKWebview and choose an item in the list, after that we will never be able to click it ever again on that same dropdown (it will never open again), unless we click elsewhere on the webpage (removing the focus that was on the dropdown). That only happens on Mac, on iOS it works fine. This is another Mac Catalyst problem on Mac.
1
1
1.4k
Jan ’22
make App Clip work with different main app build configurations
I have two different build configurations (Debug & Release), backed by their respective *.xcconfig file. The app also embeds an App Clip. Both build configs have a different Bundle ID, which are both registered properly in the dev center. Everything worked fine (I could have both configs installed and running on my phone as two separately identified apps) before I added the App Clip. Now since I added the App Clip, I cannot anymore compile my app properly in both configurations. I get different issues in either scenario and it has to do with my App Clip not matching either of the main app's build configurations. I think my problem boils down to my inability of making the App Clip's "Parent Application Identifiers" work both ways. If I set that to my main app's ID $(AppIdentifierPrefix)com.my.app I can build Release fine - which is what I currently fall back to - I live with the fact I can only debug with the Release config for now. If I set it to my debug app's ID $(AppIdentifierPrefix)com.my.app.staging I get The com.apple.developer.parent-application-identifiers entitlement ('["TEAMID.com.my.app"]') of an App Clip must match the application-identifier entitlement ('TEAMID.com.my.app.staging') of its containing parent app. If I just add both app ids there - since it's an array in the plist file, I get There can only be one parent application identifier associated with an app clip, but multiple parent application identifiers were found in the entitlement plist. I had tried to add different build configurations for the App Clip and setting its "Parent Application Identifiers" dynamically as $(AppIdentifierPrefix)com.my.app$(BUNDLE_ID_SUFFIX) where BUNDLE_ID_SUFFIX would be either empty or staging but that also didnt' work for a reason I don't really remember right now. The thing is - I don't even really need the App Clip in Debug, since it won't run anyway. Debug is never pushed to Apple, so the App Clip wouldn't ever work anyway. So maybe my actual question is: How can I just not include the App Clip at all in my Debug build?
7
0
2.7k
Jan ’22
PencilKit: zoom PKCanvasView, drawing blurred (swift, iOS 15)
It seems PKCanvasView overrides the property UIScrollViewDelegate which inherits from the UIScrollView to PKCanvasViewDelegate. And does not provide access to UIScrollViewDelegate. In order to implement zooming, so I added a PKCanvasView into my own UIScrollView. And implemented delegate method viewForZooming in which return PKCanvasView. But all drawing in PKCanvasView was blurred when zooming or scale. How to re-render drawing after zoom to make it has reasonable stroke width and clear ? Some related code: let canvasView = PKCanvasView() let scrollView = UIScrollView() override func viewDidLoad() {     super.viewDidLoad()     self.view.addSubview(scrollView)     scrollView.addSubview(canvasView)     scrollView.delegate = self     scrollView.minimumZoomScale = 0.5     scrollView.maximumZoomScale = 2.5 } func viewForZooming(in scrollView: UIScrollView) -> UIView? {     return canvasView } Some solutions I had tried: 1: Reset PKCanvasView contentScaleFactor func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) {     if let canvas = view {       let contentScale = scale * UIScreen.main.scale       canvas.contentScaleFactor = contentScale     }   } Not worked! 2: Re-render PKStroke: func reRender(_ scale: CGFloat) {     let newStrokeWidth = strokeWidth * scale     var newDrawingStrokes: [PKStroke] = []     for stroke in canvasView.drawing.strokes {       canvasView.tool = PKInkingTool(.pen, color: .red, width: newStrokeWidth)       var newPoints = [PKStrokePoint]()       stroke.path.forEach { (point) in         let newPoint = PKStrokePoint(location: point.location,                        timeOffset: point.timeOffset,                        size: CGSize(width: newStrokeWidth, height: newStrokeWidth),                        opacity: CGFloat(1), force: point.force,                        azimuth: point.azimuth, altitude: point.altitude)         newPoints.append(newPoint)       }       let newPath = PKStrokePath(controlPoints: newPoints, creationDate: Date())       let newStroke = PKStroke(ink: PKInk(.pen, color: UIColor.red), path: newPath)       newDrawingStrokes.append(newStroke)     }     let newDrawing = PKDrawing(strokes: newDrawingStrokes)     canvasView.drawing = newDrawing   } Not worked! Still blurred, just changed strokeWidth by multiply scale. 3: I try to reset PKDrawing or PKStroke transform by using scrollView scale. Then PKDrawing position disordered and it was still blurred. Please help me.
5
4
4.4k
Jan ’22
printInteractionController choosePaper called multiple times with iPadOS15
I am having problems printing a pdf file in an iPad app when running iPadOS15 or later. With previous iPadOS versions, the choosePaper delegate method is called just once, and is called with a paperList of several valid entries (30 in the case of my printer). Since iPadOS 15, the call is made numerous times. Firstly, it is called a few time with 0 entries in the paperList. Then it is called with the correct number (30 in my case) of entries. But then it is called several more times, with just 1 (and incorrect) entry in the paperList. Has anyone else come across this?
2
1
1.8k
Jan ’22
How to verify that Apple's CDN has picked up newer version of the apple-app-site-association file?
We updated the file ~2 days ago and the feature we are working on seemingly does not work - web links never open in the app, always end up at the browser. I set up new test site, added the file there and linked it up with the app. Tapping the link opens in the app. So my conclusion is that Apple's CDN is not updated. But how I can verify that?
5
1
14k
Jan ’22