Post not yet marked as solved
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.
Post not yet marked as solved
I have a problem with grayscale PNG Images which are loaded as completey black Images only on iPad 4 with iOS 10. On newer iPads this problem doesn't appear.The Images are loaded normally from the Filesystem. I also created a Bug Report but i dont get any answer. This Bug doesn' appear when i create a new Image from this grayscale Image with RGBA ColorSpace.
Post not yet marked as solved
In Unit Test, I have a simple table view with a bunch of basic cells (cells with just a label). I would like to access the cell using `cellForRow(at:)`, so I can test thing like selecting and deselecting the row programmatically, but this `cellForRow` queiry always returns `nil`.There is some discussion online that I should be using the data source's `tableView(_, cellForRowAt:)` instead. This is _not_ my intention. I only want to test the cell's visibility, test selecting and deselecting them. To test for visibility, `cellForRow(at:)` is the right function to use. Furthermore, the data source's `tableView(_, cellForRowAt:)` has no safeguard for out-of-range index access, while table view's `cellForRow(at:)` will gracefully return `nil` in this case, which I also wanted to test my table view controller on.However, while I can always get a valid cell from `tableViewController.tableView(_:cellForRowAt:)`, I couldn't understand why I always get `nil` from `tableView.cellForRow(at:)`. I have verfied both the `tableView` and the `tableViewController` are not `nil` in my unit test, and I have also triggered view loading with:_ = tableViewController.viewin `setUp()`. I also verified with `tableView.indexPathsForVisibleRows`, and the result _does_ include the index path I used for `cellForRow(at:)`.When I queried my cell through LLDB and breakpoints, sometimes my cell would show up properly. Is it possible that I am missing things like asynchronous waiting since loading up cells visually may be done in a different thread? Am I supposed to add expectation waiting of some sort to wait until the cells are fully loaded up before I can access them with `cellForRow(at:)`, even through `tableView.indexPathsForVisibleRows` already returns the expected index paths.? I tried to set this up but I'm not sure how to override my table view controller's `init()`.Here's my code in the Unit Test class.import XCTest
@testable import TableViewTest
class TableViewTestTests: XCTestCase {
private var appDelegate: AppDelegate!
private var tableVC: TableViewController!
override func setUp() {
super.setUp()
appDelegate = UIApplication.shared.delegate as! AppDelegate
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
tableVC = storyboard.instantiateViewController(withIdentifier: "TableViewController") as! TableViewController
// Trigger view load and viewDidLoad()
_ = tableVC.view
}
override func tearDown() {
super.tearDown()
}
func testGetFirstRow() {
let tableView = tableVC.tableView!
let indexPath0 = IndexPath(item: 0, section: 0)
let cell0 = tableView.cellForRow(at: indexPath0)
let visibleRows = tableView.indexPathsForVisibleRows
XCTAssert(visibleRows != nil) // PASSED
XCTAssert(tableView.indexPathsForVisibleRows!.contains(indexPath0)) // PASSED
XCTAssert(cell0 != nil) // FAILED
}
func testGetFirstRowDataSource() {
let tableView = tableVC.tableView!
let indexPath0 = IndexPath(item: 0, section: 0)
// This won't check for cell visibility.
let cell0 = tableVC.tableView(tableView, cellForRowAt: indexPath0)
let visibleRows = tableView.indexPathsForVisibleRows
XCTAssert(visibleRows != nil) // PASSED
XCTAssert(tableView.indexPathsForVisibleRows!.contains(indexPath0)) // PASSED
}
Post not yet marked as solved
Hi,I have a lot of UIViews where the compiler forces me to add an init(coder:) initializer, like this:class FooView : UIView /* or a UIView subclass */ {
...
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
...
}It claims it's required but my program runs fine without it. I do not create the views from an archive.This makes me wonder if something is wrong here with the design of the library, or the concept of a 'required' initializer. What do people think? Does it make sense or is this a wart? If so, can it be fixed?Rob
Post not yet marked as solved
Tableview contain 1 textfield where I can search product from Server, that time it shows list in tableview when I select on list it should save in same row in beneath of textfield.I want to show tableview list on particular cell where I searched term in textfield it shows in particular cell. after that I want to save selected value in particular cell.You can see in below screenshot when I search in first textfield it shows in second textfield of UITableview cell.
Post not yet marked as solved
Hello everyone, Is there a way to make an application widget like button appears all the time, even on the home screen. I want to make a floating button which will appear on top of all the apps. I want to build an application similar to assistive which will appear on home screen and on top of other apps.
Post not yet marked as solved
`UICollectionView` documentation is sparse at best. `performBatchUpdates`is a complete enigma. I have been trying to get all 4 (move, add, delete, reload) operations working correctly in the update space. I have some hope that Apple has correctly implemented the handling but I wish they would explain what on earth they are doing.Here is what I'm trying to get to work. I have two arrays with similar items in various orders and animate the changes. Simple right!? Here are the arrays: po newItems.map({ $0.representedID }) ▿ 3 elements - 0 : "5ccbdfd08d9b423a9bb78310ffe7e92b" - 1 : "9130a12b035543099f30a6cd9c6b6081" - 2 : "e0d1a52ed9f3440b859d47db4f4709f4" po previous.map({ $0.representedID }) ▿ 4 elements - 0 : "9130a12b035543099f30a6cd9c6b6081" - 1 : "458b0523c4104a4bbcb420dc01aeb143" - 2 : "e0d1a52ed9f3440b859d47db4f4709f4" - 3 : "5ccbdfd08d9b423a9bb78310ffe7e92b"You can see we lose one item between previous and new items and the rest shift around a bit.I have some logic to calculate the differences and process that in the perform batch updates which are below: Changes for section:0 Removing :[1] Moving from:0 to 1 Moving from:3 to 0 reloading :[2]This makes sense to make the previous turn into the new we remove 1, move item in 0 to 1, move item in 3 to zero and simply reload index 2.This crashes every time here: *** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3683.300.2/UICollectionView.m:5744 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to perform an insert and a move to the same index path (<NSIndexPath: 0xc000000000200016> {length = 2, path = 0 - 1})'Where is this magic insert coming from? Any ideas the algorithm they are using performing these changes?Here is the sequence of the batch changes: collectionView.performBatchUpdates({ model.applyChanges(changes) print("Changes for:\(section)") if !changes.removeIndexes.isEmpty { print("Removing :\([Int](changes.removeIndexes))") self.collectionView.deleteItems(at: changes.removeIndexes.map({ IndexPath(row: $0, section: section)})) } for (from, to) in zip(changes.moveFrom, changes.moveTo).sorted(by: { $0.0 < $1.0 }) { print("Moving from:\(from) to \(to)") self.collectionView.moveItem(at: IndexPath(row: from, section: section), to: IndexPath(row: to, section: section)) } if !changes.addIndexes.isEmpty { print("adding :\([Int](changes.addIndexes))") self.collectionView.insertItems(at: changes.addIndexes.map({ IndexPath(row: $0, section: section)})) } if !changes.reloadIndexes.isEmpty { print("reloading :\([Int](changes.reloadIndexes))") self.collectionView.reloadItems(at: changes.reloadIndexes.map({ IndexPath(row: $0, section: section)})) } }, completion: { _ in print("Done updating:\(section)") self.updateEmptyState() })
Post not yet marked as solved
Hello everybody!I am currently writing a Cordova Native Plugin for Contact Synchronisation on Android and iOS.The existing one is not enough, because it just allows you to add, edit and delete local on-device contacts.My requirement is to add "Contact Providers" like Facebook or Viber, which means that I want to adda seperate group of contacts,that is not editableand defined with our own name and icon.During my research i found this unanswered stackoverflow question and this mainly unanswered apple developer forum entry.Both want to accomplish the same, but neither has found a solution.The Android-version of the plugin is working, but it seems that an API to create CNContainers is not available on iOS.I really hope that I just do not find the API, but it is exposed by Apple!Thank you very much in advance,Bernhard
Post not yet marked as solved
HiI'm trying to share a PDF file stored on the phone using the UIDocumentInteractionControllerBut even though the menu appears with all the options none of them work. I think I was able to provide a bit of more information when I tried to use the AirDrop. I got a debug message saying "The transferer faild because there are no valid files to send" (this is a rough translation, the message was localized)I have the following codeextension ExportedReportsTableViewController: UIDocumentInteractionControllerDelegate {
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
func shareFile(filePath: String, loc: CGRect) {
let stripPath = filePath.components(separatedBy: "/")
let fileName = stripPath[stripPath.count - 1]
let timestamp = fileName.replacingOccurrences(of: "Report", with: "").replacingOccurrences(of: ".pdf", with: "")
let newFileName = Date(ticks: Double(timestamp)!).toString(format: "dd MMMM yyyy HH:mm")
let nsURL = NSURL.fileURL(withPath: filePath)
let url = nsURL as URL
let dic = UIDocumentInteractionController(url: url.absoluteURL)
dic.uti = "com.adobe.pdf"
dic.delegate = self
dic.name = newFileName
//dic.presentPreview(animated: true) <-- It works perfectly
dic.presentOptionsMenu(from: loc, in: self.view, animated: true)
}
}If I use the (presentPreview) method it works perfectly (even the share inside that controller) but with the presentOptionsMenu method it fails to send (the menu appears)I can only assume that's a function for the delegate? The url is valid (it works on the preview)Any ideas?BTW it's possible, when sending change the file name?For example the file name is "Report082182414.pdf" and when sent it appears "17 July 2017.pdf" (I know a work arround but requires copying the file with a new name and I wanted to avoid that)Thanks in advancePedro Cavaleiro
Post not yet marked as solved
I've created a new Xcode project and I added a new Custom Keyboard Extension Target by using Editor > Add Target > Custom Keyboard Extension.Then, I ran that default templated keyboard on my real device (not happened in simulator). And I opened Instruments > Allocations application to profile memory allocations of extension.When I was trying the keyboard on WhatsApp, I've noticed that number of Persistent ViewController objects were increased while hide/unhide the keyboard by tap on the outside of the keyboard and tap input area.Number of Persistent KeyboardViewController:2 -- hide -- > 1 -- show -- > 3 -- hide --> 2 -- show --> 4 (increasing)I was trying the keyboard on iOS Messages app too. And there was no duplication.1 -- hide --> 0 -- show --> 1 -- hide --> 0 ( its ok )Do u have any idea about this issue ? Why WhatsApp application duplicates the keyboard extension viewController.
Post not yet marked as solved
I am using WKWebview to load a webpage that has a list of media files.When I select a media file, I want it to be played locally only, and not through airplay.For this I use the following code snippet: var webView: WKWebView let config = WKWebViewConfiguration() config.allowsAirPlayForMediaPlayback = false webView = WKWebView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height), configuration: config) print(webView.configuration.allowsAirPlayForMediaPlayback)However, airplay is still used for media playback and the value "allowsAirPlayForMediaPlayback" remains set to true.
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
How do I get a background image to fill the screen in my launch screen on an iPhone X?I have aligned the image to the top and bottom layout guides, but this leaves large white gaps.
Post not yet marked as solved
How to increase font size of date picker?
I have a fully working FileProvider on iOS11 and I can serve up files and save them back with one exception. When I open my FileProvider in the Files.app I cannot paste or drag items into it. I get a little "not allowed" icon. If I try to Paste, the only menu option is "Info".Also, when I save a document from an application (e.g. Word), the Move button does not appear.I have implemented allowsAll on all my FileProviderItem objects:var capabilities: NSFileProviderItemCapabilities {
return .allowsAll
}and my FileProviderExtension implements importDocument, but it is NEVER called: override func importDocument(at fileURL: URL, toParentItemIdentifier parentItemIdentifier: NSFileProviderItemIdentifier, completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void) {
print("###\(#function): URL = \(fileURL), parentItemIdentifier = \(parentItemIdentifier)")
completionHandler(nil, nil)
}I also notice that the create folder button is disabled.What are the minimal requirements to allow new files?
Post not yet marked as solved
Hello,So presently when working with one of my UIViewControllers that has a scrollview, I want the scrollview not to extend past the navigationbar.However, in deselecting the IBDesignable "Under Top Bars" in the viewcontroller's attribute inspector in storyboard, it adds a dark tint to the navigation bar which I would like to remove.I've also tried "deselecting" this option programmatically to see if there was a difference, by setting in viewDidLoad(): edgesForExtendedLayout = [ ]But that still causes the dark tint to appear.Here are some pictures of the changes in storyboard simulation: but the dark tint is similarly applied when actually running on device.Does anybody know the recommended way to circumvent this?
Post not yet marked as solved
I'm struggling to figure out how to rename an instance of a UIDocument subclass in an iCloud folder. I've tried saving the document with the new URL…func renameDocument(to name: String) {
let targetURL = document.fileURL.deletingLastPathComponent().appendingPathComponent(name)
.appendingPathExtension("<extension>")
document.save(to: targetURL, for: .forCreating) { success in
guard success else {
// This always fails
return
}
// Success
}
}…but this fails with…Error Domain=NSCocoaErrorDomain Code=513 "“<new-file-name>” couldn’t be moved because you don’t have permission to access “<folder>”." UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/1A9ACC2B-81EF-4EC9-940E-1C129BDB1914/tmp/(A Document Being Saved By My App)/<new-file-name>, NSUserStringVariant=( Move ), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<new-file-name>, NSFilePath=/private/var/mobile/Containers/Data/Application/1A9ACC2B-81EF-4EC9-940E-1C129BDB1914/tmp/(A Document Being Saved By My App)/<new-file-name>, NSUnderlyingError=0x1c4e54280 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}…and just a simple move…func renameDocument(to name: String) {
let targetURL = document.fileURL.deletingLastPathComponent().appendingPathComponent(name)
.appendingPathExtension("<extension>")
do {
try FileManager.default.moveItem(at: document.fileURL, to: targetURL)
} catch {
// This always fails
}
// Success
}…which fails with…Error Domain=NSCocoaErrorDomain Code=513 "“<old-file-name>” couldn’t be moved because you don’t have permission to access “<folder>”." UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<old-file-name>, NSUserStringVariant=( Move ), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<new-file-name>, NSFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<old-file-name>, NSUnderlyingError=0x1c4c4d8c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}Both of these work fine for local files, and renaming iCloud files works OK in the UIDocumentBrowserViewController root view controller. My guess is that there's some permission missing somewhere that allows the app to write to iCloud folders.For info, the info.plist contains all the following keys…LSSupportsOpeningDocumentsInPlaceNSExtensionFileProviderSupportsEnumerationUISupportsDocumentBrowser
Anyone know where I can get a list of all the UserDefaults keys? I can't find it in documentation.
I have a view that I would like to be kept in the "safe area" in the iPhone X, never obscured by either the corners or the notch. That requirement is easy enough to fullfill using the safeAreaLayoutGuide API. However, I want the view to extend under any navigation or toolbars that appear. Even with "Extend edges" under top bars, bottom bars, and opaque bars, the safeAreaLayoutGuide is always adjusted to not be under the bars. Is there some compromise that I'm missing that keeps the view out from under the corners and notch, but allows it to be under the bars? Is there some property on the view controller that I could use as a constant for a constraint relative to the top and bottom anchors that I am missing? It seems like all of the various insets properties on the view controller are all zero when I inspect them, but perhaps I've missed one? Thanks!
Post not yet marked as solved
UIImageWriteToSavedPhotosAlbum work well in iOS 9/10but crashed in iOS 11what 's problem?NSData* imgdata = [NSData dataWithContentsOfFile:path]; if (nil != imgdata) { UIImage* saveImg = [[UIImage alloc] initWithData:imgdata]; if (nil != saveImg) { UIImageWriteToSavedPhotosAlbum(saveImg, nil, nil, nil); return 1; } }