Unexpected number of splitViewControllers when targeting an iPhone - ios

I'm learning to use the split view in an app. I am asking the table to reload the data every time I add new things. My code and settings are seem fine. But not work on iPhone. After I ask someone and he told me to try on an iPad device, it works.
Finally, I find out where the problem is, but I don't know how to fix it. I added a line that prints the size of splitView.viewControllers. The iPad simulator returns 2, which is what I am expecting. But it returns 1 without any changes in the iPhone device. So, what's wrong with it, and how may I solve it? Thank you very much.
enter image description here
enter image description here

Related

How to dismiss the UIActivityViewController during a UI test with Xcode 11 & iOS 13

Apple has re-designed the share sheet that appears, which has now broken my UI tests.
I have attempted to record a new UI test through Xcode, but as soon as I tap on the dismiss button, the test terminates so I have not been able to capture the event.
Ultimately, I just want to know how I can access the gray 'X' shown with the arrow below:
I have just tested this with Xcode 13 and have found that the original answer no longer works. However, I am keeping it for posterity, or those using previous versions of Xcode.
Xcode 13
I have tested this with Xcode 13.0 and verified it works for iPhone and iPad:
let activityListView = app.otherElements.element(matching: .other,
identifier: "ActivityListView")
XCTAssertTrue(activityListView.waitForExistence(timeout: 2.0))
activityListView.buttons["Close"].tap()
Previous versions
After some trial and error, I was able to locate where my specific elements were with the following:
app.otherElements.element(boundBy: 1).buttons.element(boundBy: 0).tap()
Using app.otherElements.element(boundBy: 1) would identify the share sheet for me. I had attempted to locate it through accessibility identifiers, but I could not find one that worked, including previously valid ones used in iOS 12 and below.
Please note that based on the layout of your screen, the index value
may differ from what I am seeing.
Next, .buttons.element(boundBy: 0).tap() was used to locate the Close button. I again attempted to use identifiers, but could not find anything that represented the button.
When I attempted to discern additional information through the console while testing, I would always wind up crashing the test. This result was surprising, as I was able to query these elements with Xcode 10.
Ultimately, I would like to find working identifier values so that I can have something that works reliably across products, without the trial and error to find the share sheet's index value.
For iPad
The following will dismiss the popover for an iPad:
app.otherElements["PopoverDismissRegion"].tap()

Seeing small dashes under Button's title in Xcode 8.1

I was creating a simple app in Xcode 8.1 with swift 3 and I got this problem (picture): dashes under buttons symbols.
How can I fix this issue?
Thanks.
So Nirmit dagly (https://stackoverflow.com/users/3401707/nirmit-dagly) has given the exact solution and it works perfectly.
He says: "You need to check button style on your iPhone device's setting. To check please go to General -> Accessibility -> Button Shapes. If it is enabled, then make it disable and run the app again. It'll hide the underlines from buttons."
I do thank him for his helpful answer and I has republish it here for the benefit of others.
Thank you again Nirmit and I prefer if we can get other independent solutions(not linked to the parameters of the phone user.).

iPad Splash Screen setting warning in App Target

These are the splash screen of my iPad application.
Default-Portrait.png (768 × 1024)
Default-Portrait#2x.png (1536 × 2048)
Default-Landscape.png (1024 × 768)
Default-Landscape#2x.png (1024 × 768)
The problem:
I upload all these screen in my application. Then set
Default-Landscape#2x, Default-Landscape & Default-Portrait in App Target as iPad Splash screen.
Now when I try to set Default-Portrait#2x, I find "No image Specified" message in "Portrait Non-Retina" section.
Like this:
And then when try to set Default-Portrait again, I find "No image with correct dimensions found" message in "Portrait Retina" section.
Like this:
And this thing happen no matter how many times I re change them one after one. What is the reason of it? If any one have any clue please share that with me. I check my "image name" and "size", no problem in there. I set these splash in a Cross platform "Cordova" project.
Thanks in advanced. Have a nice day.
Addition:
I also try it with these names, but no luck.
Default-Portrait~iPad.png (768 × 1024)
Default-Portrait~iPad#2x.png (1536 × 2048)
Default-Landscape~iPad.png (1024 × 768)
Default-Landscape~iPad#2x.png (1024 × 768)
List item
I don't know why it didn't take the default name in this case. But I set it with the following name and solve it. If anyone get into the similar problem try with these name:
Default~ipad.png
Default~ipad#2x.png
Default-Landscape~ipad.png
Default-Landscape~ipad#2x.png

iOS UI Automated Testing: How to pull down, drag or scroll in a CollectionView?

I am testing my app with the UI Automated Testing framework. I have a UIACollectionView I would like to pull down or drag my CollectionView. I already tried the ways from the documentation:
to drag up
target.dragInsideWithOptions({startOffset:{x:0.5, y:0.9}, endOffset:{x:0.5, y:0.2}, duration:2.0});
or to pull down:
target.dragInsideWithOptions({startOffset:{x:0.5, y:0.3}, endOffset:{x:0.5, y:0.8}, duration:2.0});
when this didnt work I tried to use the inheritated methods of the UIAScrollView. chatList is my UIACollectionView
archivedChatCell = chatList.cells()["Noise"]
archivedChatCell.scrollToElementWithValueForKey(1, "isVisible")
chatList.scrollDown()
chatList.scrollToElementWithPredicate("Noise")
But nothing is moving in the screen. I read in some threads that this (dragInsideWithOptions) is a Apple problem that needs to be fixed for the iOS7 UI Testing.
Does someone have any idea what the problem is? Am I missing something or is there a work around for that?
The weird thing is, I am using the same code in a different CollectionView in my App, the dragInsideWithOptions works fine and drags or pulls the screen.
thank you
Yes, dragInsideWithOptions and flickInsideWithOptions are not working on the simulator. However, they do work on a real device. Therefore, my suggestion is to use a real device until Apple fixes the problem.

Image being loaded before app main method is called

I have an ipad app where I am seeing an image displaying briefly before the app starts (image is part of bundle).
My guess is that this is some wrong wiring of a xib file, but even when I set a breakpoint at the beginning of the main method, the image still appears before this point is reached.
Resetting the simulator does not help, and the scenario occurs on a device too.
Mmmm is the image named Default.png ?
I just don't see an other explanation for this problem ^^
By the way, I just don't use Interface Builder to avoid this kind of strange problems ^^

Resources