My app uses NSUserDefaults and it is running as expected in the simulator on Xcode 8 with an iOS10 option selected.
I have an old iPhone 5 I use for testing and I have upgraded this to the iOS10 GM and my NSUserDefaults are not working.
The app does not crash but it just does not save any information when I set an NSUserDefault.
Any idea why this might be happening?
Sorry I have found the problem, it is with my UISwitch
All of the NSUserDefault code is working fine.
The switch was what set the UserDefault and I have found that if you slide the switch it does not register but if you tap the switch it does.
I have found that this bug started in iOS 7 so when I updated my app for iOS 10 and the Development Target moved up to iOS 8 the bug started.
So in the simulator the switch responded to a tap but on the device if I slide my finger across the switch it didn't register even though the switch changed state.
Thanks for the suggestions anyway.
in Xcode 8 / iOS10, NSUserDefaults is now UserDefaults, and standardUserDefaults() is now standard() - Try updating your code to this new name scheme and see if that fixes it.
Here is the Apple documentation on the dropping of the NS prefix: https://github.com/apple/swift-evolution/blob/master/proposals/0086-drop-foundation-ns.md
Related
When i run the xcode4.5 build of my project on ios7 then keyboard appearing is not ios native keyboard which is native to ios7 but it is showing the previous greyish keyboard but alertview is working fine.
I can move to xcode 5 but there is many UI issue when i switch to xcode 5.
Reset of things are working fine with xcode 4.5
You need to switch to Xcode 5 for the keyboard. There is not other way I know of. Also the users will like your app more if it has the iOS 7 features.
As already mentioned, you need to move to Xcode 5. As you've noticed, the alertViews (and actionSheets) will be iOS-7-ified automatically, though.
When running Xcode shows older version of the project both on iOS simulator and iOS Device! It never shows the new background picture I have added although it's there in the storyboard and saved!
I tried cleaning the project even with the option key pressed but still!
I have localizations and it was working well!
What could it be? Where is the problem?
I tried searching but I ran out of terms and still no effective results.
Sometimes apps get "stuck" in the simulator. Try deleting it (long press, then click the "x") and then check ~/Library/Application Support/iPhone Simulator/[ios version]/Applications to see if it still exists. If it does, just delete it.
You can also try iOS Simulator > Reset Content and Settings....
I had a similar issue where an old storyboard were used on device instead of the most updated one I was working on.
The problem was due to the localization, I had my storyboard localized in 2 different languages and the device were using the storyboard localized in an other language than the default one which was somehow outdated.
Hope it helps.
Why does Adsupportframework work on my iOS5 simulator? I thought if you enabled adsupportframework as a requirement on a iOS 5 simulator it would cause the simulator to crash. When I enable the social framework this cause my iOS 5 simulator to crash which it suppose to. This is kind of bugging me.
AdSupport framework is introduced in iOS6. To avoid crash in device with iOS5 or below, just make it optional framework. See image reference here:
My app works fine on iOS 3.3, but after I upgraded my iPhone to iOS 4.2.1, I started to see some weird behaviour.
When I start my app on the upgraded iPhone, it goes blank. I have to tap the Home button to close the app.
The problem is, the app did not crash. It just showed me a blank screen. So I don't have any crash report to track this issue down.
Has anyone seen this before? Is it an iOS 4.2-specific issue? What steps can I take to determine the cause so that I can fix my code?
The behaviour of iOS did change between iOS3 and iOS4. As a first step, try walking through your code with the debugger. Also check your application:didFinishLaunchingWithOptions: method in your main App Delegate class.
A quick search also turned up some useful info about a similar issue: App shows white screen on startup after upgrading to iOS 4.2
The link also has info on how they managed to find out what was happening.
I'm trying to get the following functionality in my iPhone app:
When backgrounded, stays running (doesn't have to do any background work)
When resumed, app picks up where it was left off
I'm mainly wanting the same screen on my app still up, as there are several UINavigationControllers within a UITabBarController.
I have done all of the following:
Made sure I'm compiling with 4.1 SDK
Set UIApplicationExitsOnSuspend to false
Handle DidEnterBackground and WillEnterForeground in my AppDelegate
Call BeginBackgroundTask in DidEnterBackground, to attempt to keep my app open
I'm using MonoTouch, but that it probably beside the point. I can take answers in Obj-C, for sure.
I've tested my app on a jailbroken phone with Backgrounder, and I see the "app in background" badge disappear immediately after pushing the home button. I also tried setting UIBackgroundModes in my Info.plist, but to no avail.
Is there anything I'm missing?
Or is this something I would have to implement on my own to resume the previous state of my app? Everywhere I've read talks like it should just work automatically.
If you don't want to be doing work in background, don't call beginBackgroundTask. That call is for situations where you want to do some kind of work in the background. And if you don't finish that work fast enough, iOS will terminate your app.
When I upgraded to iOS 4.x, my MT application started exhibiting this behavior without me having to do anything. iOS should take care of it for you.
I finally got in touch with someone on MonoTouch's irc.
In MonoDevelop there is an option to make a dual iPad/iPhone project, which I used. This is causing my app to behave as if it's running with the 3.2 SDK when deployed to the device.
I think my solution is to install the iOS 4.2 SDK that just came out, since this ads the new multi-tasking feature on iPad.
Not only do you need to support going into the background, you also need to support cases where your app has been terminated. In your app’s initialization code, you should resume the state that it was in. For instance, when you push a view controller, use NSUserDefaults to store a value for the currently-displayed screen, and then when you start read that value and display the associated screen.