Does iOS Simulator Save Core Data? - xcode

Everytime I run my app on the iOS Simulator, the current data I have stored is reset. I was wondering if this is natural for the simulator to do that, or if it is something with my code? If I run it on my phone, it works when I double tap home & close the app, but if it crashes, it resets. Thanks!

Saving works the same in the simulator as on a device. It's not normal for simulator data to just disappear under any circumstances.
However, note that each type of simulated phone is, in effect, a different simulator. If you simulate once on a simulated iPhone 6 and then on a simulated iPhone 6+, it's normal for data saved in one to not be available in the other.

Related

Is it possible to add a mobile operator to Xcode iPhone simulator?

So I need to add a mobile operator to Xcode simulator. Currently it looks like this
And i want it to be like this
So my question is if there's a way to do it in the Xcode simulator and if so how?
The status icons you see depends on the model of the iPhone. According to this page, phones that use Face ID do not display the carrier in the status bar, and phones that use Touch ID do.
iPhone models with Face ID
iPhone models with Touch ID
So just go to File -> Open Simulator, and select a different simulator that uses Touch ID, such as iPhone SE.
Also,
If you can't see an icon, check Control Centre by swiping down from the top right-hand corner.
I don't think so that you can achieve exactly same that you posted in question but in iOS we have flexibility to change simulator status bar like battery level, time, WiFi state, cellular state.
this feature is called simctl you can Google more details about it.
to specifically change status bar use simctl status_bar
I dont think u can add mobile cause of similator doesn't have SIM card. operator.Similator can work as a real device as coding, but it does not contain all the features of the real device. Simulator is a program and other device.
If you want to do something for a feature that can only be on a real device try this with a real device like mobile operator operations
It's similar to taking a photo from the phone and uploading it to the app. The simulator does not have a camera feature, so if you try to open the camera in the simulator, the application will crash. You need to test this on a real device

How to force an app to simulate in iPhone simulation using an iPad using Expo?

I'm currently using Expo to build an iPhone app.
I'm not supporting iPad and I have it so when it builds on iPad it runs in an iPhone Simulation.
The problem is I can't develop with Expo using this approach.
The app shows up as an iPad app, but this is not the mode being shipped to users.
According to this I might have some luck adding ios.supportsTablet to the app.json file and setting it to false but it didn't change anything.
Is there another configuration value I'm missing to force iPhone simulation mode on an iPad?
I'd rather not eject if I don't have to.
According to this, there currently isn't a way to live develop using "iPhone mode" on an iPad.
The Expo Client app can’t change its tablet support on the fly,
unfortunately, so it will always adapt your project to the iPad
viewport.
So, following the above forum here is how you get around it:
Run exp build:ios -t simulator
Open Simulator
Select Hardware/Device/iOs 11.x/iPad x generation
Unpack the generated build from the first command
You should have a file named yourApp.app
Drag that file into the iPad you are running in Simulator
It will install the app on the device and you can then view your creation
This is faster than doing a whole build cycle with TestFlight just to see your changes.
But it still leaves a bit to be desired.

Custom Keyboard Crash

I made a custom keyboard. Everything works fine except of two things:
(I am using Xcode 7 and am testing the app on my iPhone 5.)
When I turn the device from portrait to landscape or the other way round
sometimes it does not change the formation and crashs.
I wonder why this happens only sometimes and not every time the first time.
When my phone is not connected to Xcode it does not work like
when it is connected to the computer.
It crashs when I was not in the app for around 5-10 seconds and I open
it again then.
It does not pop up again and a restart is necessary.

App only crashes in certain devices ios8

So I recently had my app rejected by Apple. This is what they said:
2.1: Apps that crash will be rejected
----- 2.1 -----
We found that your app crashed on iPad running iOS 8 and iPhone 5s running iOS 8, which is not in compliance with the App Store Review Guidelines.
Your app crashed when we:
tapped on various menu items
If you have difficulty reproducing this issue, please try testing the workflow as described in Testing Workflow with Xcode's Archive feature.
I found it confusing why the app was only crashing on certain devices, especially the iPhone 5s. Since I don't personally own a 5s, I have been using the simulator and cannot recreate the crash. On the iPad retina simulator the app crashes when I press menu buttons and Xcode tells me the offending line is in the viewdidappear method of the view being segued FROM:
if( adBanner != nil )
{
adBanner.removeFromSuperview()
adBanner.delegate = nil
adBanner = nil
}
My questions are: How can I recreate these crashes on the iPhone 5s? How can I possibly fix this bug on the iPad or do I even need to? I assumed you could submit an app optimized to run on only certain iOS devices and that was determined by which devices you submitted screenshots for. Do I need this app to work for iPad or is there a way to just not publish it for iPad?
Mine was not also for ipad, but Apple still tested for that anyway.
I had the same issue. I was reproducing the issue on my ipad 2 when the project options is set to "link all assemblies" on my Xamarin project settings. The issue was not reproduced and the app on my ipad was working fine when I change options to only "link SDK assemblies only." This has been the reason with another app I published.
I'm going to try republishing the app again with that change in setting and hope for the best.
How can I recreate these crashes on the iPhone 5s
An iPhone 5c might reproduce the issue, but your best bet is to use an iPhone 5s. The simulator cannot possibly match behavior of the device when it comes to timing and memory characteristics.
You might be able to use guard malloc or NSZombies to find some issues related to memory mismanagement, so I suggest you try that out in the sim or on devices you own.
Do I need this app to work for iPad or is there a way to just not
publish it for iPad?
You can build an iPhone-only app that will be run in compatibility mode on an iPad, but there's no way to prevent someone from running your iPhone app on an iPad.

Xcode 4.5 New Simulator not displaying properly

I have just finished installed xCode 4.5 and have been trying to understand the new simulator. I want to test my app in the old screen size and new screen size. However when under the simulator I go to hardware and change the phone size to the 4 inch size, it changes the simulator to take up the full screen, has no home button, is zoomed in, and I have to scroll to navigate which is really frustrating and annoying.
From this
To this
Could someone tell me if this is meant to happen? I want to maintain the normal iPhone look with the simulator, that zoomed in scrollable simulator is terrible, looks horrible and makes debugging a pain. I am sure Apple would not allow something this poor looking to be the normal look for the simulator so I am guessing I am doing something wrong.
The other problem with it is, if I am on the home screen where I can see a list of custom apps under normal iPhone screen size, then change it to the 4 inch simulator screen size, the custom apps I installed on the simulator are not showing for some reason.
Any help would be much appreciated!!
Edit:
I found I change the scale of the simulator under window and changing it to 50 or 75%. However one problem remains, why is there no home button in the iPhone 5 simulator?
What computer are you working on ? I've got a 13'' MacBook and the same thing occurred to me. Some topics say it is related to your screen resolution, and if your screen is "too small" then the simulator won't see the need in a frame representing the physical device. See Nathan Gopen's answer in XCode 4.3.1 iPad simulator. (I also noticed that the frame disappears when you re-scale standard iPhone to 75% or 50%.)
If you need the home button you can find it in Hardware > Home Button, or Shift+Cmd+H. Yeah, I know, it sucks...
This Worked for me:
Go to Simulator Menu
Go to Hardware
Click Device
Click IPhone
This will restore the iPhone Simulator frame.
What worked for me was...
Go to XCode,
Open the main XCode menu option
Click on "Open Developer Tool"
Click on "iOS Simulator"
Change to the simulator you want by going to the "Hardware" menu.
Close the simulator
Run your project again.
XCode was crashing on me when I switched to the non-retina iPad option and this was my solution.
The simulator seems to remember the last hardware option that was chosen.
I don't think it's related to the screen resolution. I'm running it on 1920x1200 and it's the same. I guess it's simply to reduce effort for Apple since it's not essential for development to have a nice looking simulator. But yes, I agree I loved to see a virtual iPhone as simulator. And it was quite easier to produce screenshots of your Apps for your website.
Zooming or scrolling is of course not required on a 1920x1200 screen.
This just happened to me and I did spend a while trying to figure this one out.
By setting the scale to 100% my issue got fixed as Cal said above.
I think this is related to retina display setting ...
When I started the iOS simulator on my macbook pro (w/rd), the iPhone frame came up. I moved the frame over to my attached monitor and it stayed as an iPhone frame. I shut xCode down.
When I restarted, the iOS simulator started up on my attached monitor and lacked the phone frame, just showing the screen. Scaling up or down did not matter.
I moved the unframed screen over to my laptop screen again, and shut down the simulator. When I started it back up, it started on the laptop screen with the phone frame.
I don't think it is related to resolution so much as retina display.
Not sure if this is long term solution, but the following steps helped me.
Go to Windows >> Scale
Select different options as per your wish (I chose 75%)

Resources