I am running Visual Studio 2017 version 15.3.4 with Xamarin on Windows. I'm newbie in iOS. I did two iOS projects to test: a blank iOS app in which I added a MainAppViewController.cs and MainAppViewController.xib. Info.plist main interface is set to MainAppViewController. AppDelegate is:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds);
MainAppViewController mainViewController = new MainAppViewController();
// If you have defined a root view controller, set it here:
Window.RootViewController = mainViewController;
// make the window visible
Window.MakeKeyAndVisible();
return true;
When I run app and launchs the iOS Simulator, it is showing a black screen on the simulator. No buttons on simulator work (home, settings, etc.). Obviouslly I'm connected to a MAC agent to do that.
When I tested the same project by using VS2017 community in MAC, works perfectly. I checked info.plist and for some reasons Main Interface is (none), no matter if I set it correctly, it shows (none) when I reopen. I copied info.plist from same project in VS2017 on MAC and same problem: Black Screen.
To Check if I'm doing some wrong, I reopened a project that uses a Storyboard with a Navigation Controller that I did some months ago and it worked perfectly on same PC in the iOS simulator in Visual Studio 2017 on Windows at that time, and suddenly it not worked now. Shows same Black Screen on iOS simulator on Windows. I tested this app on MAC and it works perfectly.
Recently I updated VS2017 with latest releases.
I checked info.plist and for some reasons Main Interface is (none), no matter if I set it correctly, it shows (none) when I reopen.
If you use storyboard as main interface in your app, you must set it in info.plist, open info.plist with the way XML(Text) Editor,you can see UIMainStoryboardFile there.
But I see you use a xib class as the main interface , and set it programmatically in AppDelegate , in the way you don't need set main interface in plist.
When I tested the same project by using VS2017 community in MAC, works perfectly.
I'm also facing your problem , I guess maybe something wrong with MAC agent.
After doing that above, if it still doesn't work,
What I do
Modify the build configuration ,run again.
Close the application, delete the bin and obj folder in your project, then clean and run again.
Reconnect the mac agent.
Restart your windows PC and Mac.
Try the solution I provide(according to the priority).
Its not clear to me from the Q whether the iOS Simulator was being displayed on Mac screen, or on PC screen.
In my situation, I had just run simulator on Mac from VS Mac, to be sure it was working and up-to-date. I was expecting to then show it on Mac, from VS on PC.
HOWEVER I did not know that VS 2017 on PC had:
Tools / Options / Xamarin / iOS Settings / Remote Simulator to Windows CHECKED.
(Which means to show simulator on the PC itself. "Remote" is w.r.t. OSX host that
is actually running the simulator code.)
I stopped debugging on Mac.
Then debugged remote from PC.
The Mac simulator restarted [on Mac monitor], but simulator screen was black.
[As if part of the code thought it should show on Mac, but then the screen image was sent into limbo, trying to go to PC - but there was no window on PC to show it.]
Fix:
Stop debugging (on PC).
Quit Simulator (on Mac).
UNCHECK "Remote Simulator to Windows".
Start debugging (on PC).
Result: Simulator on Mac started up correctly.
If anything goes wrong:
Leave Mac alone for 10 minutes, to be sure simulator is finished launching.
Go through all the steps again.
NOTE: If haven't run simulator since XCode has updated, may need to first launch XCode, go to your account in preferences, re-enter your Mac password.
May also need to wait up to 10 minutes on simulator first launch.
I suspect it is installing something.
My black screen on startup issue in VS2017 targeting the iOS simulator was resolved after overriding the Window property in AppDelegate, as illustrated in this video: "How to fix black screen after App startup in Xamarin.iOS" https://www.youtube.com/watch?v=UVkbkXCm1vU
Info.plist seemed to be working/saving just fine. Deleting bin/obj directories, cleaning, rebuilding, etc. didn't help (for the obvious reason that my code was incorrect).
Thanks,
a.s.
I figured this out after a few hours.
My issue was at the Info.plist, below what I did on Visual studio for windows:
Right click on the info.plist and select Open with
Choose iOS manifest editor
Click on the tab visual effect
Go to the Launch Images
Make sure the option Source and Launch Screen are set up properlly
Clean your entire solution
Rebuild project
Try again
in my case Source was set as none.
enter image description here
Related
I'm using the release version of xCode 8 and am trying to run my app on the simulators. They are all the iOS 10 simulators.
No matter which simulator I use, when I run the app the app icon shows up in the simulator but then that's it. The app never displays in the simulator. I only see the app icons of the iOS home screen.
I put some break points in my initial view controller at the viewDidLoad, viewWillAppear, and viewDidAppear methods. All of them triggered. So as far as my app is concerned, it is displaying on the device. I also get all the normal log output and networking calls happening just fine. It even shows the popups for permission to access the calendar and notifications. But my app is not brought to the foreground.
If I then click on the app icon in the simulator, my app runs normally. But it should be automatic when I hit run from xCode.
When I run my app on an iOS 10 device I get the same behaviour as all three of those view methods are called. However I don't get any of my normal log output. In fact I don't get any log output. However the app was already installed from when the device was on iOS 9.x. Not sure if that is a factor. But aside from the simulator issues, this is the bigger issue.
I've tried cleaning the build, deleting the app, I even tracked down the derived data folder and deleted that from the simulator. None worked. I also updated all my cocoa pods I have installed too.
Any one else experienced this?
That sounds weird but I read a lot of threads on the Apple Developer Forums on the same problem during the different Xcode 8 beta version, try these steps:
reset the simulator using the menu "iOS Simulator" -> "Reset Content and Settings..."
remove your 'xcuserdata' directory inside your .xcodeproj directory
do a clean build folder (hold down option key when selecting clean)
reboot your Mac
If these steps don't solve anything you can try this solution:
Copy-paste Xcode-beta.app from Applications folder to somewhere else, e.g. - Documents folder.
Delete Xcode-beta.app from Applications folder.
Move Xcode-beta.app from Documents to Applications folder again.
originally posted here, obviously using your Xcode.app instead of Xcode-beta.app.
I'm trying to deploy a multi-platform application (written in Delphi XE7 + Firemonkey) to iOS Simulator, through these parameters:
Delphi XE7
OSX 10.8 Mountain Lion
XCode 5.1.1
Command Line Tools
PAServer 15.0 (iOS SDK 7.1 - also tested with 6.1)
My Application needs to work in Windows, Android, iOS and OSX. Working already for all but iOS, including OSX which I compile to using the same setup, with no problems.
I created a connection profile to my PAServer, using a password, and this profile works OK both compiling to OSX and when compiling a hello-world-ish application for iOS, just with a button or two.
As for my app, I can compile and build it for iOS without a problem, but when I try to run it in iOS-Simulator, it compiles, deploys, and when launching, it fails, returning an error:
Unable to launch process on '192.168.25.37' using the parameters from the 'iOS' profile.
The following error was returned: 'Session Ended'
This is my first app for iOS, so I'm swimming in strange waters here.
It has no external libraries, except of course for the ones Delphi itself might add when compiling. I myself did not, and the app has just forms, and accesses a text file in its sandbox folder, and a mysql server via UniDac (direct mode, no dll's).
I tried to get to the bottom of it, commenting out sensible code in my app, namely everything that was iOS specific, but that amounted to nothing.
I then created a new app, just a button and a ShowMessage on its handler and it worked.
Next step, I started trying out my app units on this simpler app. The first one I tried was a unit I have for a custom component (a TRectangle with a TPanel, 3x TImage, a TLabel and a TCheckbox inside), with another class with a Generics TObjectList of the component). I just added this unit, without instantiating any class, and it failed, reporting an 'unknown error'.
So I removed the unit from the project to double check: Again it fails, with the same button and showmessage that worked before.
I've installed then the SDK 7.1, but failed as well.
I've been looking through the web trying to make some sense out of it, and have found several similar cases, but none that could actually help me:
Delphi FireMonkey iOS App: Error while Deploying to iPhone Simulator 8.1
On this case, there's a problem with PAServer and there's a fix for it, but it refers for SDK 8.1 and XCode 6+
Unable to install and run iOS app on Simulator from command line - Simulator of iOS 6.1 Xcode 5 on mavericks
I couldn't install ios-sim via the refered way, most probably because I have zero experience with OSX.
Still, I cloned it from GitHub and managed to install it via command line and XCodeBuild with some help from internet, but when I tried to run my app, ios-sim says it needs at least XCode 6, which I don't have (OSX 10.8 here, I believe Xcode 6 needs at least 10.9).
After that, I installed another, iPhoneSim, and strangelly, after that ios-sim no longer questions for Xcode6. Still, it fails to start my app (even a freshly created hello-world-ish that works when run via Delphi), stating:
DEBUG] Failed to find class DTiPhoneSimulatorSystemRoot at runtime.
Even tried installing WaxSim, but this one failed to install.
I did not however tried compiling it for a iDevice, because for that I need to subscribe Apple Developer program, and I was hoping to do that only after making sure everything was working OK. Plus, I', not sure it would make a difference.
Has anyone experienced this 'Session Ended' problem, and if so, do you know of any reason and fix.
Thank you
After a few days, I found out what the problem was, so I'll post the solution here to help others who might have the same problem.
Go to Project --> Project Options --> Version Info
Under de iOS Simulator configuration, Delphi IDE (XE7) automatically inserted the following key and value:
CFBundleVersion = 1.0.0
As it turns out, there are several other tweaks needed for an iOS project:
Here are the keys found in Embarcaderos iOS demo app "Location", which solved my problem once I inserted them in my project:
CFBundleName = $(ModuleName)
CFBundleDevelopmentRegion = en
CFBundleDisplayName = $(ModuleName)
CFBundleIdentifier = $(ModuleName)
CFBundleInfoDictionaryVersion = 7.1
CFBundlePackageType = APPL
CFBundleSignature = ????
LSRequiresIPhoneOS = true
CFBundleAllowMixedLocalizations = YES
CFBundleExecutable = $(ModuleName)
UIDeviceFamily = iPad & iPhone
CFBundleResourceSpecification = ResourceRules.plist
NSLocationAlwaysUsageDescription = The reason for accessing the location information of the user
NSLocationWhenInUseUsageDescription = The reason for accessing the location information of the user
FMLocalNotificationPermission = false
There is one special key, which I believe it's the main reason for the 'Session Ended' error: UIDeviceFamily
This key has 3 options (instead of accepting any string value):
- iPhone
- iPad
- iPhone & iPad
Without this, iOS simulator doesn't know which type of app it is, UI wise, so it doesn't launch.
You need to add the key with the respective key name, and then choose the UI type using the respective ComboBox.
Also missing in the project is in:
Project -> Project Options -> Application
There is a list, both for iPhone and iPad, with the paths to the default icons, in several sizes, which is not correctly filled when creating a new Project.
So, you can either use your own icons and images, or use the defaults:
iPhone:
Application Icon 57x57: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png
Application Icon 60x60: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
Application Icon 87x87: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png
Application Icon 114x114: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png
Application Icon 120x120: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
Application Icon 180x180: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png
Launch Image 320x480: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png
Launch Image 640x960: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png
Launch Image 640x1136: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png
Launch Image 750x1334: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png
Launch Image 1242x2208: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png
Launch Image 2208x1242: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png
Spotlight Search Icon 29x29: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png
Spotlight Search Icon 40x40: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
Spotlight Search Icon 58x58: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png
Spotlight Search Icon 80x80: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
iPad:
Application Icon 72x72: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png
Application Icon 76x76: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
Application Icon 144x144: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png
Application Icon 152x152: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
Launch Image 768x1004: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png
Launch Image 768x1024: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
Launch Image 1024x748: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png
Launch Image 1024x768: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
Launch Image 1536x2008: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png
Launch Image 1536x2048: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
Launch Image 2048x1496: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png
Launch Image 2048x1536: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
Spotlight Search Icon 40x40: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
Spotlight Search Icon 50x50: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png
Spotlight Search Icon 80x80: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
Spotlight Search Icon 100x100: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png
Setting Icon 29x29: $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png
Setting Icon 58x58: $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png
We had the same error message, although with a slighty different environment (Delphi XE8 and Yosemite).
In our case, there were parentheses in the name of the connection.
We found this out by putting PAServer in verbose mode, using the "v" command, and repeating the commands we saw in a separate terminal.
Editing the parentheses out of the connection name solved the problem for us.
I keep getting the "The Simulator can't be launched because it is already in use." when trying to run my app, this only happens about 20% of the time but once so far the only way to get around it is to restart my Mac.
Tried the following but doesn't help:
Cleaning my build folder
Closing and re-opening xCode
Force close of simulator
I'm Using xCode 6 (beta 4)
Any Ideas for a solution that doesn't entail me restarting my Mac?
Thanks
"The Simulator can't be launched because it is already in use.”
This messege will be shown only if there is another xcode project that has launched simulator and hasnt stopped it yet, and u try to run the simulator from another xcode project.
Ideally stopping the simulator from the respective project(PS. not closing the application from the simulator, clicking the STOP button) would do it,
But if it still is working like that, then Closing the simulator, or resetting the simulator contents.
If that still dsnt work, then as a last resort i would ask u to reinstall Xcode, as if this problem keeps going on, then ur downloaded file might be buggy.
P.S if u opt to re-download n install xcode please keep backup.
Hope it solves it. Although i want your problem to be solved by step 2.
This normally just happens when running an app (project) on the simulator and then trying to run another app while the simulator is open (and normally is still within the first app you launched and it can't quit automatically). As long as you keep running the same app you shouldn't get this error and as soon as you run another app just make sure you've closed the simulator before or at least left the previous app with the home button.
Just Restart Your Mac , It Will Fixed
I had the same problem and fixed it without restarting. You just need to reset the content on ios simulator, exit xcode, and then to make sure that you've completely exited, right clicking on the xcode icon on your mac nav bar and click Quit. Open it back up and it should work.
I've racked my brains over this one, and I'm probably just making a stupid mistake. After switching to Xcode 4.5.1 (it may have happened at 4.5) I simply cannot load an app into the iPad Retina simulator. I've edited the compilation scheme to say to always use the Retina display for the iPad. No love. It used to be that you could change simulators on the fly and whatever one was open would be the one the project compiled for. But I can't figure out how to do this in 4.5. Help!
Something funky is going on, which seems to be not acting as expected. Try these solutions in the following order.
Your method is correct, you set your Simulator Display preference when editing your schemes. Make sure your destination for the scheme is the iPad simulator, that it's tied to the Run scheme, and set iPad Simulator display to Retina. Save/apply your scheme changes, try to run your app. If that doesn't work, close + re-open Xcode, check scheme settings to see if they stuck, and try again
You may want to double check if your changes stuck. Delve into your project file (by right clicking on your project file, and selecting "Show Package Contents"). Then navigate to:
xcuserdata->username.xcuserdatad->xcschemes->ProjectName.xcscheme
Open it up in your favourite editor, and check to see if there's a:
simulatorIPadDisplay = "2.000000"
...for your required scheme
If none of that worked, then it may be an issue with your derived data (unlikely, but step 1 should have worked). Go to Organizer, and select the Projects tab. Then hit 'Delete...' for derived data. Do the same as before; run, close Xcode, check and re-run.
Well we really are in a pickle, that is the only method to set your preferred simulator display for a build scheme. You may need to resort to removing Xcode and re-installing, and trying the previous steps again.
What on earth is going on?! We've exhausted our methods, you may need to let Apple know about this issue.
Well, after a long session of "find all of my settings files and save them, delete Xcode and all of its settings files, reinstall Xcode, re-download simulators and dockets, replace settings files, etc., etc." I found myself in the same position. No Retina simulator for me.
The problem wasn't Xcode or the project file--the 5.0 simulator will simply not launch in Retina mode. The 5.1 and 6.0 simulators work fine, as I discovered when I switched to them in the compilation scheme. Switch back to 5.0 and I'm stuck in normal simulator mode. The reason I've been using the 5.0 simulator was to test lowest-common-denominator iOS features. That, and there is a bug in iOS 6.0 that affects large packet transfer via IPSec that hasn't been fixed yet.
So, I still don't know what the missing Derived Data status was all about, except that it's fixed now and I assume that reinstalling the app was the fix.
I'm having trouble with the iOS simulator. I'm currently on 10.7 and was using the simulator to test my website. During the testing, I switched the iOS version via the tool bar, and the application froze and quit. Upon restarting, I get the following error message, with a finder window, inviting me to choose an application:
"ios Simulator Could Not Find The Application To Simulate"
Here's what I've tried to fix the issue:
1: Attempt to identify the application it needs, but the only thing i could see to open was a printer app and the ios simulator app, which just results in a "only one iOS simulator can run at a time" error message.
2: Restart the Mac.
3: Download the new Xcode tools from the app store.
4: Restart again.
None of this has helped, and I'm really stuck without it at the moment. If anyone knows how to resolve the problem, I would be grateful to hear any suggestions. Thanks.
Give this a shot.
Open up a new shell, and shoot of this command: sudo <Xcode>/Library/uninstall-devtools --mode=all (assuming thats the location of the instal).
Then run the Xcode installer you got from the app store.
This removes all the plist files that were also installed with xcode, which aren't removed when you simply reinstall. This is as close as you can come to a complete xcode refresh without reinstalling your OS.
Here's an alternative solution that worked for me... the answer selected here did not. I created a blank, "hello world" project and simply ran it. When you run the app, it sends the app to the simulator and voila! iOS Simulator has an app to simulate. From that point forward, you should be able to open the iOS Simulator without a problem.
After a while longer trying various things, it seems like I may have fixed it.
When asking for an application to open, I opened Xcode, and (weirdly) that opened up and left the testing shell visible, with the tool bar intact. I then selected the current version from the device options and hit the home button, and suddenly everything appeared.
Weird thing to have suddenly happened, but there you go.
I still can't test in iOS 3, so that's a bit of a problem, but not a disaster either!