Reading from Keychain Xcode 9 simulators returns nothing - ios-simulator

Since I'm using Xcode 9, all unit tests communicating with keychain are broken. It also happens with Xcode GM. As I traced, there is no OSStatus errors while reading and writing but reading from keychain returns nothing and causes failure for all unit tests using keychain. I've already faced something like this when Apple released Xcode 8 with iOS 10 simulator which keychain was not working and Apple fixed that in Xcode 8.2. Is anybody else facing this issue with iOS 11 simulator too? Any idea on this?

Finally we found the problem. As #Gix said the problem is with unit tests inside our framework. The SDK tests don’t have an app context, so don’t have the/a keychain available. But actually we didn't want to move the tests from SDK into app as you did #Gix. So we could fix the problem just by adding an app target in the SDK project, then set that as host for the SDK unit tests. Now unit tests are passing. But I still don't understand why its only failing in the new Xcode. We realize it's not an iOS 11 Simulator issue because the same failure happens with iOS 10 simulators in Xcode 9 too. So this restriction is a property of Xcode 9 Simulator app which can be fixed with the solution I provided. It is still messy but it works and you don't need to move tests from SDK into app!

Just figured this one out on my side, so I thought I'd let you know in case you are having the same issue.
My problem was the way I have my project set up. In my project I have a workspace with 3 projects, 1 is the Main App, 1 is a framework/library and 1 is the Pods project. I was accessing the keychain in my framework, and my unit tests target was part of this project.
After extensive discussion and work with Dan Federman from the team behind the library Valet (which you can find here), we figured out that my unit tests target needs to be part of the project where the Main App is. Once I copied all of my tests from the library project to the Main App project, everything ran and worked just fine.
Hope this helps!

Related

Xamarin UWP and Azure Mobile Services Offline SQLite Sync - problems when building in Relase mode with .Net Native Toolchain on

We have a problem when we build our app in Release mode with .Net Native Toolchain on.
MobileServiceClient.SyncContext.PendingOperations then returns -1 instead of 0 when there are no Pending Operations which result in that offline functionality no longer works (no items that are inserted when you are offline are sent over to the server).
The same phenomenon is described here:
https://github.com/Azure/azure-mobile-services/issues/890
We have tested with Visual Studio Update 2 and also with Visual Studio Update 3, but unfortunately, the problem remains in that version.
However, we have noticed that if we set "Optimize code" = false the offline functionality works, but then we instead get the following errors when Windows App Certification Kit tests have been completed.
"AppName" takes a dependency on Microsoft .Net Native Framework Package 1.x framework but is missing the framework dependency declaration in the manifest.
and
API CoCreateInstance in api-ms-win-core-com-l1-1-0.dll is not supported for this application type. "AppName.dll" calls this API.
If anyone has a solution for this, we would be very grateful!
With the help of a member from the .NET Native runtime and compiler team (Many thanks) we have been able to troubleshoot the problem and come up with a workaround!
We have worked around this issue by adding this to Properties\Default.rd.xml file:
<Library Name="Newtonsoft.Json"> <Assembly Name="Newtonsoft.Json" DoNotOptimize="true"DoNotInline="true" /></Library>​
This instructs the optimizer to ignore all of the types/methods inside of Newtonsoft.Json.
I have noticed that you reposted on the Azure Forums as well. I asked a few follow-up questions there and will answer your query there. We can cross-post the eventual answer if you like.

Visual Studio Apache Cordova - IOS build rotation issue

I'm a starter in writing app code in Visual Studio 2013 Community Apache Cordova and have managed to connect VS2013 with my Mac. Once I have gone through the process of building the app in VS and on my Mac and installing in on my iPhone, I open it up and it won't rotate. It doesn't rotate for a number of basic apps that I've written nor does it rotate if I build the default new project "Hello, your application is ready!" app.
I have done some research and tried changing the config.xml "Orientation" preference to "both", through the code window and also in the designer window but that doesn't change anything. I've also noticed that adding in a "BackgroundColor" preference doesn't work either.
Does anyone know if I may have configured something incorrectly or perhaps need to add something to my code?
All the HTML, JS and CSS that I've written seems to work okay (with the exception of trying to link URLs to the Safari Browser but that's another issue).
I have noticed the same issues. I tried finding some settings to fix that in the config.xml, but was not successful. I have resolved myself to just opening the iOS project in XCode and changing a few things:
Device Orientation: no matter the config.xml setting, its always only Portrait. I click-check the other 3 orientations.
Team: I have multiple developer profiles, and I need to choose correct one here.
Bundle Identifier. I screwed up one project, and have different case for iOS and Android. I leave the VS one as the Android one, so I can build completely correct for Android. Since I know I have to go to XCode for iOS anyway, I change the bundle identifier here.
You can find the project using Finder at ~/remote-builds/builds/9999/cordovaApp/platforms/ios/*.xcodeproj, where 9999 is the build number, though not necessarily the latest, largest number, but the latest datetime of the folder.
You can also refer to Greg's answer in this related post as an alternative solution.

iOS project works in simulator but not on iPhone 5

I have finished my project in Xcode 6. Tested on simulator. Everything works fine. So installed app on my hardware. (iPhone 5 ) however looks like prepare for segue and unwind to segue methods does not get called. Due to this properties I set in these methods stays nil. And so app crashed.
Please help.
I managed to crack it. Problem was declaration of property in .h file for NSString. It was declared weak. Changing it to strong sorted my problem.

Defines Presentation context is not available prior to xcode 4.2 [duplicate]

I'm developing an app which is iOS 4 compatible, so my deployment target is set to iOS 4.0.
Whenever I drop a UINavigationController onto a UITabBar, I get these two warnings:
warning: Attribute Unavailable: Defines Presentation Context is not available prior to Xcode 4.2.
warning: Attribute Unavailable: Defines Presentation Context on iOS versions prior to 5.0.
The UINavigationController functions as expected, in fact, the entire app runs perfectly. But these two warnings are driving me nuts!
Also, the moment I delete the UINavigationController the warnings disappear.
Just uncheck the "Defines Context" checkbox in the attributes inspector. (Double-click on MainWindow.xib, select the navigation controller, then go to View->Utilities->Attributes Inspector.) That'll get rid of the warnings.
You are getting these warnings because you are using iOS 5.0 SDK features with a 4.x deployment target.
All, if not, most of the new 5.0 hotness, including ARC and Storyboards, is completely backwards compatible with iOS 4.x (I don't remember if 4.0 or 4.3 is the lowest supported version, check the docs), it will work as intended, but Xcode is going to warn you anyways.
You should be able to disable that warning if it really bothers you, but I wouldn't. That said, Apple does not currently accept applications built/archived with the Xcode 4.2 beta for submission to the App Store. This means you need to use Xcode 4.0/4.1 in a production environment.
Before we go any further, you should know that Xcode 4.2/iOS 5 is beta software, it is under NDA (you agreed to this when you joined the Apple developer program) and cannot be discussed in the public domain. This means you won't be able get much help from places in the public eye, like StackOverflow, as good as it can be. But, since I'm here and this is a very high level question, I can help :)
In the future, if you have iOS beta questions or issues, you should hit up the Apple Developer Beta Forums (an excellent resource, always search before you post), or #iphonedev on irc.freenode.net for not-beta stuff (I'll be there, say hi!)
If you're developing an application for release on the App Store:
You need to be developing with Xcode 4.0 or 4.1, Apple will not accept applications built/archived with 4.2. (I know I repeated myself, but people seem to miss this often)
And, although 4.2b7 supports developing for older frameworks better than previous Xcode betas have (by allowing you to install previous versions of the simulator), you will still find yourself accidentally using 5.0 SDK functions all over the place, as the code completion/interface builder very aggressively favors all of the new hotness. This is because the beta is for trying new things, not stable application development.
This means you need to switch back to using Xcode 4.0/4.1 for production, if you don't have it installed, or you overwrote the stable version with the beta, do not try to install 4.0/4.1 on top of the 4.2 beta, weird things will happen and both versions will start acting really weird and and Xcode will crash at least twice as often.
The best thing to do in this situation, is to follow the below steps. Make sure you don't skip anything, otherwise you'll have to restart the whole process.
Make sure you have your code committed and pushed up,
uninstalling Xcode like this temporarily removes git. (This was an
issue for me at work once)
Download the installers for Xcode 4.0/.1, and 4.2 if you intend to keep experimenting. (if you already
have both downloaded, this whole process won't take more than 5
minutes on an SSD)
Uninstall the Xcode beta from the command line using this command:
sudo <Xcode>/Library/uninstall-devtools --mode=all (more info here)
Restart your computer (this is important, do not skip it!!!)
Install the most recent non-beta version of Xcode and resume development.
If you want to use both versions of Xcode (4.0/4.1 and 4.2):
You must install the beta AFTER 4.0/4.1 is installed, otherwise you will be overwriting new things with old things, and this will give you many, many obscure headaches. I also recommend restarting between installations.
You need to install 4.2 after 4.0/4.1, and to a different folder (I use /Xcode4beta/, don't put it within the folder that contains 4.0/4.1, either). I've found I learn about the new hotness best if I keep separate iOS5 branches of my work, and update what I can when I have some free time.
If you have the iOS5 beta installed on your phone, and Xcode 4.0/4.1 won't let you build to your phone:
This is because Xcode needs to grab the debug symbols from the phone before it can be used for devleopment, but only the Xcode beta can do this for an iOS5 beta device, so follow these steps:
Make sure your phone is plugged in and turned on, and that your provisioning profile/certificates all check out.
Close the project in Xcode 4.0/4.1.
Open the project back up in Xcode 4.2, and check organizer. You should either already have a green dot next to your phone (assuming all of your provisioning is working), or it should be gathering the debug symbols. Let this finish, and then build your project. It doesn't need to be a successful build, nor do you have to install the application to the phone, sometimes you don't even need to build, Xcode can be a fickle mistress.
Close the project in Xcode 4.2.
Open the project back up in Xcode 4.0, you should now be able to build and install to your phone as you normally would.
Xcode 4.0/4.1 should now be able to use your device for development until you restart the computer.
Resolution is here:
How can I fix "Freeform Size simulated metrics are not available prior to Xcode 4.2" warnings?
You just need to change the development version of your xib file to Xcode 4.2 (default is Xcode 4.1)
View Controller and Navigation Controller setting or options name ( attributes inspector )
Define Context ( Checked ) unchecked.

Xcode cannot run using the selected device

This is the message while trying to run under XCode 4 (it used to work under XCode 3):
No provisioned iOS devices are available. Connect an iOS device or choose an iOS simulator as the destination.
I have profiles for my device for this app... where should I be looking to correct this?
The problem is that your iOS Deployment Target in Project-> Build Settings is different from the current version of iOS on your real device.
You're asking where to find it:
In XCode 4 there is a new button - look for the big
"Organizer button"
which is at the TOP RIGHT.
Physically connect your device and then click Devices. It seems that the new "Organizer button" is one of the "most-missed" things in the transition to XCode4.
Note, the questioner is asking: "WHERE should I be looking to correct this?"
I was having extra trouble because of my Enterprise License, but still updated the iPads. I didn't have to change anything in the Build Settings to lower. But the main thing that I had a problem with was in the Organizer I needed to hit "Use for Development" button.
Kind of an old post, and may not be the best way or a rookie thing to miss but wanted to help anyone out.
My problem similar to those above were related to having the deployment target set too high for the version installed on the phone. Would be nice if it gave a more useful error message. I spent hours messing with my provisioning profile trying to fix it, when the real problem was the older version of the software on the phone.
I had the same problem. The reason was simply, that my ipad had not been update to version 4.3.
This just happened to me for iOS5 with xcode 4.2.
The answer is to go into organiser, select your device, and press the "Develop with this device" button (or similar wording).
Then go back and build, and it should work..
I received this error while having an iPad properly connected.
Some info:
Ipad iOS version: 4.2.1
XCode 4.2
XCode project created with "iOS Application / Empty Application" template.
The problem was that I had to specify the "iOS Deployment Target" to 4.2 in more than one place!
That is, both in the "Build Settings" and in the "Summary".
Very odd, and definitely another XCode4 annoyance.
I got this error in Organizer - "Could not support development.". I tried rebooting the iOS device and it worked for me :)
Check that the Executable File (also known as CFBundleExecutable) in the Info.plist file is set to ${EXECUTABLE_NAME} as opposed to any hardcoded value. This will ensure that even if you change your project name or target name or scheme name, that it still works.
you need to install the proper version of iOS.in my case it is iOS 4.0 - 4.1 Device Debugging Support
GOTO --> XCode Preferences -> Downloads --> Component
there are all updates available for your iOS click Install.
This is works for me.
It looks like this error can also come about if the "Product Name" in your target's build settings does not match the value of "CFBundleExecutable" in your info.plist
It looks like to me this is the general error Apple gives if the executable is not installed correctly on the device. When the debugger tries to attach it looks for the executable name and if it's not there they give this error. Touch one to debug.
Go to build option and select valid compiler.
Chose your right iOS Deployment version

Resources