simulate Document in Xcode 6 - objective-c

There used to be a pretty nifty command in xcode 5 where you could simulate the document. I mean when you pressed this option, only the UI of the app got loaded and then you can just see how the autolayout is working.
I forgot where this is and I'd upgraded to Xcode 6.0. COuld anyone help me where this option is in xcode?

Yes, it is gone. There's no way to get it back.
However, you can instead preview .xib or storyboard files in assistant editor. This dose not open a new window, however, the storyboard file shows the UI preview by default.

Related

Xcode 8 crashes on storyboard view and displays only blue outlines around views

I have Updated Xcode yesterday from version 7 to version 8.1 overnight and deleted the xcode 8.0 beta that i had!
Today I tried to Open all my projects, and when I go to the storyboard, I get the following Error..
An internal Error Occured. Editing Functionality may be limited. Report a Bug (which I did).
The project that I opened, does not use size classes or autolayout.
I have searched many questions on the net, which pointed that the problem is caused by projects without autolayout. or suggested that i clean xcode, simulator, deleted derived data folder.. all without success..
I also tried saving the storyboard as an Xcode7x file with no success..
Finally I tried creating a new SingleView Application and added a UIButton to it.. (while using size classes, autolayout..) still the same.. so it's definitely an Xcode Bug issue.. Not an autolayout incompatibility problem.
any hints?
p.s. compiling the project will actually run great, and all ui elements will show as intended. I don't have Xcode7 installed anymore.. any suggestions?
I can not reproduce the crashe, but I could fix messed up UI by setting up the following under Editor menu -> Canvas:
It was fixed when i updated xcode!

Add button to OSX lock screen

Is it possible to alter the existing OSX lock screen ? For example if I wanted to add a button above the users profile image that says "Hello World" on click.. is this possible?
The goal is to run an AppleScript when the button is clicked.
EDIT -
/System/Library/PrivateFrameworks/LoginUIKit.framework
Inside here you have the ability to change the login screen images and such, but also it contains several compiled nib files abbreviated with 'LUI' which I am assuming stands for 'Locked User Interface'. I'm about to set up parallels and try to open them in Snow Leopard with xcode 3.2.6, and see if I can edit the nibs. If I'm able to accomplish this, would editing such files be in violation of their TOS?
Another possibility was running a window above it. On screen lock I can get the window above the screensaver simply by saying
[window setLevel:NSScreenSaverLevel]
but still, that doesn't overlay the login screen.
I feel like this shouldn't even be possible, but I seen something similar on the Knock to Unlock app.
Did you try to use the following line?
[window setLevel:CGShieldingWindowLevel()+1];
I'm using it to do the same as KnockToUnlock and it works like a charm. I see my window above the login screen either if I come on the login screen from the sleep mode or the screensaver.
Hope this helps.

Why does OSX/Cocoa dock icon revert to default before going away?

I'm working on wrapping some Cocoa functionality in an Objective-C library that will be called from a cross-platform C library. One of my goals is to provide someone who does development in C on Linux with the ability to deploy to OSX without having to get into XCode, nib files, etc. I want them to be able to compile and link their code on OSX using the command line tools, and end up with a regular resizeable main window with the usual buttons and so on, an application menu and a dock icon that looks and behaves as expected, etc.
I'm working on OSX 10.8.5. I have XCode 5.0 installed. Here's my gcc --version output:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
I've figured out how to present a main window, how to set up the application menu, and various other things, programmatically, without using XCode or any nib or plist, but I've run into a problem with the dock icon.
I set a custom dock icon image by calling:
[NSApp setApplicationIconImage:dockImage];
When the user quits the app, the dock icon image reverts to something else (some kind of default application icon or view), briefly, before going away. How can I prevent that from happening without using XCode to create a nib or a plist?
I've tried setting the activation policy of NSApp to prohibitted in the app delegate's applicationShouldTerminate method, to try to hide the dock icon before this switch back occurs. That didn't help, it does hide the window and the dock icon, but the dock icon still switches back to the default icon, briefly, as part of the process of hiding. I confirmed this by returning NSTerminateLator, and confirming that setting the activation policy to prohibited does cause the dock and the icon to hide even though the app is not terminating, and not setting it leaves it unhidden.
I've tried subclassing NSApplication and overriding the setApplicationIconImage call. I have confirmed that it is being called a second time, by something other than my code (well, or not directly by my code, anyway), just before the program exits. I've tried preventing the second call to it from working by calling the super function the first time, but not the second time, and I've confirmed that code in that function can prevent my code from changing the application icon, but that didn't fix the problem. It still happens anyway, somehow.
I've also tried removing the application badge, like this:
[[window dockTile] setShowsApplicationBadge: NO];
just in case it was something to do with that, but that didn't work. The docs say that app badges are no longer relevant as of 10.6, but I was grasping at straws.
Being stumped on the programmatic front, I'm now trying to find out how to package an .app from scratch,without using XCode, and see if maybe I can create a plist from scratch that has a reference to application image in it. But a programmatic solution would be preferable, as I'd really like to minimize what goes into the OSX-specific packaging of a deployment.
Another possibility might be to use XCode once, to produce a very generic, bare-bones .app that my deployment scripts copy and alter.
Please don't shoot my question down as being "too broad" or "not constructive" or something like that. I realize I'm reinventing wheels that already exist in various forms, but there's no law against trying to build a better mouse trap, or just a different or even a worse one, for that matter. I realize I'm trying to fix a problem that a lot of people would consider inconsequential, but XCode-produced apps don't have this problem, and I really don't want the tools I'm creating to produce any user-visible artifacts like that. I'm not intending to diss Apple's tool chain or invite debate about whether or not what I'm pursuing should be pursued. I have a specific, technical problem that I'm looking for solution to that is within the constraints of my goals.

changed product name in build settings, now app won't launch in simulator

I wanted a different title to be displayed in the sub-title under my iPad app's icon and changed the Product Name for my app under Build Settings.
This worked but has had a strange side effect. Whilst the app continued to work perfectly on a connected iPad, on the emulator it now behaves in a similar way to that described in [this question].1
Namely, it says it has finished running <my app> on iPad 6.0 Simulator
I tried changing the Product Name back but the problem persists.
I also tried some of the suggestions on the other question (e.g. removing armv7 frfom Required Device Capabilities) but nothing worked.
This isn't a showstopper at the moment as I have a real iPad to test on but I'd still like to understand what is going on, if anyone knows.
Sounds like time for a reboot of the Mac. Restarting Xcode might suffice. One other thing to try is to delete the app from the simulator.
I have seen this on iPhone simulator 6. Many a times, when you click "Run" again - it runs without problem.
However if that doesn't work, you may try one of the following:
Project->Command+Alt+Shift+K - a choice will appear saying something like clean folders. Do it.
In organizer, go to derived data folder (finder) using tiny arrow just at the right of your project. Try deleting your project from finder. If it doesnt delete at once, try it often.
Try resetting iPhone or iPad simulator.
Exit XCode and reopen project. Do the same with iPhone / iPad simulator.
If you are wondering why this is happening, no one really knows! It's just some flags gone bad, restored once you re-do everything for it to work, that's it.
Have you tried switching off the Debugger?
So Edit Schemes -> Debugger -> None
Also restarting the Simulator and Xcode and cleaning the project may help
Use another way: click on the azure icon of your project, keep the trackpad pressed until you see it allows to edit the name. Choose the name that you want, then a sheet like this will appear:
Click "rename" and you're done with it.

xcode window creation

I'm very new to OSX programming and I've been trying out a few examples in various articles and I've been facing a problem ; at that point I decided to follow tutorials from "Cocoa Programming for MacOSX" and Im running into the same problem.
My project name is "Random" and when I click "Build and Run", it shows the status as "Random running". However I don't see the window that pops up. Why does this happen?
I had a look at this SO thread and unfortunately it does not help.
[EDIT]
"Random" is a Cocoa application for Mac.
[EDIT2]
I tried doing the same with a new cocoa application and the problem persists. Here is what I did. Create a new cocoa project named "blah". Click "Build and Run" - from what I am reading im supposed to see an empty window - however I dont see the same.
[EDIT3]
My Xcode version details :-
Xcode IDE: 1610.0
Xcode Core: 1608.0
ToolSupport: 1591.0
Generally you will have a window visible if you have it in the xib that is loaded with you main menu and it is marked to be visible at launch... This should be all set up if you chose the window based application, if you chose document based then you will get a window when you select new from the file menu