Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics

Post

Replies

Boosts

Views

Activity

NSError localizedDescription in another language
Even if the operating system language has been set to something else (such as Finnish), NSError.localizedDescription seems to always have the description in English. I need the error message provided by the system in Finnish, but I have no idea how to achieve this.Somebody on the internets says that in order to achieve this, one has to create a new localization in the Xcode project (which happens on the Info pane of the project settings). I don't need localizations per se, because this project is supposed to be in one single language. Either way, when I try to add a new localization (by clicking on the + button and selecting "Finnish") nothing happens. It shows an empty list of files to localize, and when I click the Finish button, nothing at all happens. No new localization is added to the list.(I'm wondering if this happens because the project has been created in an unconventional manner. More precisely, it has been created by SpriteBuilder. Changing the project to something else is pretty much out of the question, so that's not a solution.)I just want the Finnish version of localizedDescription. How can I retrieve it from the system?
5
0
3k
Sep ’15
AXIsProcessTrustedWithOptions not prompting for permission
I'm trying to use the Accessibility API and have this code: NSDictionary *options = @{(__bridge id) kAXTrustedCheckOptionPrompt : @YES}; BOOL accessibilityEnabled = AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef) options);This always returns no, however it does not prompt the user for permission nor does it display the app's name in System Preferences > Security & Privacy. What do I need to test this? I could try and add the debug version manually into System Preferences but how do I know that this will work properly when released to the public? Is there any way to test this out? I am not seeing any prompt at all.
6
0
5.3k
Oct ’15
MPMediaQuery is always nil for Movie or TV Shows
Hello,I can no longer query for user's Movie or TV Shows. This used to work before iOS 9. MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInteger:MPMediaTypeMovie] forProperty:MPMediaItemPropertyMediaType]; MPMediaQuery *query = [[MPMediaQuery alloc] init]; [query addFilterPredicate:predicate]; NSArray *items = [query items];Returns nothing. As does MPMediaTypeTVShow.Any hints ? Thanks.
2
1
616
Jan ’16
Clearing cookies in SFSafariViewController?
I am using SFSafariViewController to authenticate against a website (SAML idP) and retaining my session using a cookie. I opted to use SFSafariViewController because my users could log in to the site using Safari or another app's instance of SFVC to achieve single sign on because as I understand it, the cookie store between native Safari and instances of SFSafariViewController are more or less shared. However, clearing the cookies in Safari settings in the settings app doesn't clear the cookies in my app's instance of SFVC. I have also tried logging out of the site in Safari but the cookie / session is still retained in my app's instance of SFVC.Is this expected behavior from SFVC?Thanks,Lucas
5
0
9.2k
Jan ’16
Launching iOS app from iCloud Drive
My iOS app supports a document type and includes the appropriate UTI data. It can therefore open documents of a specific type from mail attachments, for instance. It works well.I am currently stumped, however: when I open a document from the iCloud Drive app (tap document, share button, "Copy to <app>") my application gets launched but any attempts to copy the item from the provided URL fails with NSCocoaErrorDomain, error 257 (basically telling me I don't have the permissions to read the file). This issue is not present when my app is running in the background, however, and does not seem to occur when the app gets launched from a mail attachment (whether it's running ot not).I compared the URLs handed to my app and they are identical, whether the app was running or not.Here's the URL my app is handed: "file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/filename.ext"The code I'm using is the following:// uniqueURL is a destination URL in my app's sandbox: // file:///var/mobile/Containers/Data/Application/12AB2BA0-EA63-4FAC-A7D8-779964868B06/Documents/filename.ext dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { let fileCoordinator = NSFileCoordinator(filePresenter: nil) fileCoordinator.coordinateReadingItemAtURL(url, options: .WithoutChanges, error: nil) { newURL in do { try NSFileManager.defaultManager().copyItemAtURL(newURL, toURL: uniqueURL) } catch { print("Error!") // this is where I'm getting NSCocoaErrorDomain:257 } }This issue seems to be identical to that other thread:https://forums.developer.apple.com/message/29985#29985However, I'm not running on a beta OS. My device is an iPhone 6s running iOS 9.3.2 (13F69).
11
1
40k
May ’16
NSURLSession data tasks always buffer the first 512 bytes unless content type is JSON?
Does NSURLSession data tasks buffer the first 512 bytes before it calls URLSession:dataTask:didReceiveResponse:completionHandler: as well as URLSession:dataTask:didReceiveData:? And is the buffering disabled when the Content-Type is application/json?I was experimenting with NSURLSession and was hoping to make it possible for my app to do something as soon as the HTTP header is received or as the first batch of raw data is received. I wrote a simple server to test, but what I described below can also be tested with services like httpbin.org. I noticed that:URLSession:dataTask:didReceiveResponse:completionHandler: is only called before URLSession:dataTask:didReceiveData: is called, though the doc says the former "[tells] the delegate that the data task received the initial reply (headers) from the server", and I thought it meant that the delegate method would be called as soon as the header is received even if the response body is not yet seen, but that doesn't seem to be the case.URLSession:dataTask:didReceiveData: is only called for the first time when the server sends 512 bytes in total (or closes the connection if the total content length is less than that). After the first 512 bytes, the delegate method is called as soon as a new batch of data is received. If Transfer-Encoding is used for chunking, the 512 bytes apply to the decoded bytes, not the raw bytes over the wire.However, if Content-Type is application/json, URLSession:dataTask:didReceiveData: will be called as soon as one byte is received. This Stack Overflow discussion mentioned this seemingly undocumented behavior.One can see the buffering in action with a simple HTTP server, or just use httpbin.org, for example with https://httpbin.org/drip?numbytes=1024&duration=8; if you use "curl -N" to fetch that URL, you'll see some characters received soon after the the request started, but if you use a data task to fetch it, it'll be a few seconds until the two delegate methods mentioned above are called, and the first batch of data is always >= 512 bytes long.The thing about this is that they don't seem to be documented anywhere, and I appreciate if there are some clarifications on the API contract. Thanks!
6
1
2.5k
Oct ’16
Traffic Attribution for Universal Links
I would really like to turn on Universal Links for our app, but our SEO team keeps preventing us from doing it. They say, they need to know where traffic is coming from. For example, when a user opens Google in Safari and finds our URL, and taps it, they want to know he came from Google. (Btw. Our app is a wrapper for a website, however with features not available to mobile web users - not sure if that is relevant.)Is there any way in iOS to get a URL, or any other traffic source information at all, that would allow us to track where app users are coming from?
5
0
5.1k
Oct ’16
Launch Screen Image not Updating!!!
Hi, I am a iOS developer. I have an iOS app currently running in Appstore. I am in the process of updating the app’s Launch image. Previously the app had a Launch screen image which was added in LaunchScreen.xib and in the update I want to change the Launch screen image. If I try to use the same xib with different image, the app takes the previous image as Launch screen image. I also tried using completely new xibs and image assets but the splash screen becomes a blank white screen in this case. Any helps to fix this will great.
10
2
53k
Nov ’16
File Provider Extension, importDocumentAtURL:: can't read file at given URL (iOS 11.4.1)
I'm having troubles with Paste opertaions into my containers in File Provider extension.If I paste copied image or text into Files app -> My App -> any folder the file at fileURL can not be read (as a result can't be uploaded to my servers nor stored locally).- (void)importDocumentAtURL:(NSURL *)fileURL toParentItemIdentifier:(NSFileProviderItemIdentifier)parentItemIdentifier completionHandler:(void (^)(NSFileProviderItem _Nullable importedDocumentItem, NSError * _Nullable error))completion { NSError *readError = nil; NSData *fileData = [NSData dataWithContentsOfURL:fileURL options:NSDataReadingMappedAlways error:&readError]; NSString *readErrorMessage = readError.localizedDescription; NSURL *myFileURL = [NSFileProviderManager.defaultManager.documentStorageURL URLByAppendingPathComponent:@"temp.dat"]; NSError *copyError = nil; BOOL copyResult = [_fileManager copyItemAtURL:fileURL toURL:myFileURL error:&copyError]; NSString *copyErrorMessage = copyError.localizedDescription; ...copyResult is false, both readErrorMessage and copyErrorMessage are:The file “text.txt” couldn’t be opened because you don’t have permission to view it.What am I doing wrong here?This happens to any file copied from my container, iCloud container, as well as synthetic files produced from text/image/other data from system Clipboard.For emalple, fileURL for image.png file I'm trying to duplicate from my own container isfile:///private/var/mobile/Containers/Data/Application/80480715-574A-4E99-B588-FBDCC7F1FDFC/tmp/DDBD7C7B-56C0-4F61-94A9-109613C78F75/image.png/The same time the item being duplicated is located at:file:///private/var/mobile/Containers/Shared/AppGroup/A8C1416D-8435-407E-82B3-CE10A8439630/File%20Provider%20Storage/Document93838429/image.pngI guess I cant ready anything in /private/var/mobile/Containers/Data/Application/80480715-574A-4E99-B588-FBDCC7F1FDFC/Thanks.
12
2
46k
Sep ’18
Xcode Preview error: "A coordinated install for ... is already pending."
Hi,When testing my SwiftUI code, I sometimes get the new Xcode preview system having this error:Error Domain=IXErrorDomain Code=29 "A coordinated install for xxxx is already pending." UserInfo={NSLocalizedDescription=A coordinated install for xxxx is already pending., SourceFileLine=143, FunctionName=+[IXAppInstallCoordinator(IXSimpleInstaller) _beginInstallForURL:consumeSource:options:completion:]_block_invoke, NSLocalizedFailureReason=Unhandled reason for code: 29 in domain IXErrorDomain}The workaround I have found is to reboot my Mac (I will edit this post if I find a less radical workaround).Note: Version 11.0 beta 2 (11M337n)
3
1
4.6k
Jun ’19
MetalKit in SwiftUI
Hi,Are there any plans for integrating Metal/MetalKit with SwiftUI?Is that correct that current recommended way of the integration is to use UIViewControllerRepresentable like in the tutorial?Thank you!
18
1
12k
Jul ’19
Navigation Link Issue with SwiftUI
I have been using ScrollView with SwiftUI to develop a Custom Table Structure due to certain Customisation limitations with ListView. As soon I as I add NavigationLink for each item in scrollView. The icons or Images in the items are highlighted to blue color. Is this an already reported bug or is it something which I should avoid doing?
12
1
12k
Jul ’19
popToRootViewController in SwiftUI
What is the best practice to achieve popToRootViewController like functionality in SwiftUI? There are couple of ways to do it and one of them is described nicely here (https://stackoverflow.com/questions/57334455/swiftui-how-to-pop-to-root-view) via publish event but it losses the animation while popping to root. Please suggest.
3
0
5.6k
Sep ’19
How to remove SwiftUI TextField focus border?
How does one remove the focus border for a TextField in SwiftUI?In Cocoa, setting the border to "None" in interface builder would remove the border.I've tried using .border with a width of zero, but that does not work. The .border adds another border on top of the focus border.Setting the style also does not do the trick.
2
0
4.2k
Oct ’19