Xcode builds on Debug but not on Release - objective-c

So, I have this problem when trying to build my project.
Currently If I run the project in Debug mode, it runs fine, the app starts up on the device and I can test stuff.
However the weird part is when i switch over to the Release build and try to build on the device. When I press the Run button Xcode builds as normal and the build succeeded notification even pops up, but then I get this error code.
Lets call my app xxx
Could not launch "xxx.app"
No such file or directory:
/Users/*my Name*/Library/Developer/Xcode/DerivedData/*Bunch of xcode folders*/Products/Release-iphoneos/xxx.app/xxx
I went into finder and searched up xxx.app and couldn't find it. Furthermore there doesn't even exist a Library folder under /Users/my Name/.
So what is xcode trying to do here, and what should I do to fix this?
Edit: I have also tried Cleaning the project and building again, the error code still comes up.

I get this crap all the time.
What I do is clean the project, close it, shut down Xcode, start up Xcode, open project, then build and run.
If that still does not work then find the "DerivedData' folder Organizer->Projects and delete it, then do the above again and try again.

I tried creating a new scheme and setting it to Release mode. That worked for me. However, a reboot after closing xCode seems to work, too.

I went into finder and searched up xxx.app and couldn't find it. Furthermore there doesn't even exist a Library folder under /Users/my Name/.
It does exist, but it's hidden (since OSX Lion) in the Finder (because standard users -- as opposed to developers -- should not mess with it).
Some utilities (on a simple command line) can make it visible again but the simplest thing to do is to use "Go" menu of the Finder and select "Go to folder…" (Command-Shift-G). Then copy/paste the path you want to go to and validate.

Related

Codename One: App broken after iOS build

I have been building my App for Android repeatedly without any errors. I know tried to also build it for iOS which would not work, since I now know that I need a Mac.
After that, I tried to build it again for Android and now everything seems broken. IntelliJ tells me everywhere that it "can't resolve Symbols" and "can't resolve methods". I tried opening and closing the IDE and also restarted the computer, tho I am not able to make a successful build again. This just started after the failed iOS build.
Here is a Screenshot for you, those are very simple lines, there is no reason for them not to work. I am really clueless right now what wrong.
Maybe someone of you has an advice for me? I can only repeat, i did not change the code at all, but it just won't compile anymore, neither in the simulator nor with the Android build.
That may be due to a missing or corrupt CodenameOne_SRC.zip and/or CodenameOne.zip and/or JavaSE.jar files.
Solution:
Create a new dummy Codename One project, right click on the dummy project and select Properties then click the Update Project libs button. Once it's done, close the dialog and right click the project again, then navigate to Codename One -> Refresh cn1lib files.
Now close the dummy project and minimize your IDE and go open your Dummy project folder in your file explorer. Now copy the CodeNameOneBuildClient.jar and JavaSE.jar found in the main folder to the relative path of your faulty project, replace them if already exist. Do the same for CLDC11.jar, CodenameOne.jar, CodenameOne_SRC.zip that are found in the lib folder of your dummy project.
Go back to IntelliJ and right click on your faulty project and navigate to Codename One -> Refresh cn1lib files, then clean and build your project.
This should fix any reference or missing class issues.
FYI, you don't need a Mac to build an iOS project in Codename One.

ConnectionKit app not opening on other Computers

I created a Mac app that uses ConnectionKit to connect to a server using FTP. Today I went to export the file and use it on another computer only to find that the app does not open entirely on a different computer.
On the development computer, the app functions completely, but on another computer, it opens, the icon stops bouncing in the dock, and the name of the app is shown in the menu bar, but the first view controller and window are never opened.
The menu is also not visible. It just shows the app title and nothing else.
I assume that this has to do with ConnectionKit, but I checked the package contents of the exported bundle and ConnectionKit is in there under Frameworks.
Here are the steps I took to include it.
I downloaded ConnectionKit using git clone
I downloaded each git submodule using git submodule update --recursive --init
I dragged the ConnectionKit.xcodeproj file to my Frameworks directory in the project explorer
I added ConnectionKit from the workspace into the "Link Binary with Libraries" section
I added a new "Copy Files" build phase.
I changed the destination to "Frameworks"
I added the ConnectionKit.framework from the Products of the ConnectionKit.xcodeproj to the copy files phase.
The build phases tab looks like this:
This doesn't seem to work. The application just sits there and doesn't launch the app on any computer other than the development computer.
What am I doing wrong here?
You need to run the app in Xcode under the debugger on one of these other computers. It sounds very likely that you are getting a raise at launch. Seeing the raise in the debugger would doubtless shed light on the cause, which might or might not even have anything to do with ConnectionKit. :-> You could also look at the console logs generated by your app, in Console.app (in Applications/Utilities/), but actually getting the raise in the debugger is generally more useful unless the problem is something very obvious.

XCode hangs every time when i write few lines of code in playground

I have just started working with Swish after buying my new imac and i am working on play ground. for last 2 days i am banging my head with wall but i could not fix this problem.
When ever i am writing few lines of code, Xcode hangs and mouse turns into small colored circle when you hoverover on the xcode window. I have to quit by force every time when xcode hangs.
I tried all possible option which i could find on stackoverflow;
I draged xcode from application to trash bin, cleaned trash bin, restarted the imac, downloaded xcode from app store installed it.
when i opened xcode after installation, it opened all my files automatically and problem was still there.
Then i followed this solution How to uninstall Xcode 5.0.2 from MAC 10.9 and removed all xcode related files by using appCleaner. It cleaned all files and folder. I restarted my system and installed xcode again :( and problem is still there.
I tried to uninstall xcode with sudo /Developer/Library/uninstall-devtools --mode=all but it does not work, terminal says
sudo: /Developer/Library/uninstall-devtools: command not found
I could see that there is something wrong with this run time compiler.
and yes i downloaded and installed the xcode 6.4 beta version and problem still there.
Can any one turn my face from :( -> :)
Here is a solution which #user3344236 provids. If someone has same problem use this trick. Create an empty project and then add playgrounds file in it. It would not crash or Xcode would not hang.
Playground is in early stages and there is something fishy with "standalone" playground, If you create swift file with File->New->PlayGround, there is high chances that Xcode will hang and you can have same problem what i had for 2 days.
A little late, but I have run into similar problems with the latest XCode (7.2) on Yoesmite. This is espcially annoying when you are, for example, writing up a long tutorial in the editor and risk losing content because of a Force Quit situation.
The simplest workaround I have found, especially when I am initially entering all the text and code (and hence really don't want it continuously trying to execute) is to insert the following at the top of each new file - removing it when I am ready to autorun the code.
don't execute
It can be any text, as long as it doesn't parse. The playground environment won't try to run while there is a syntax error in the file. But you still get all the context-sensitive help and auto-completion magic to aid in your writing.

UIKit.h not found error

I made a single view app for the ipad, with a movie, webview and button, and I get this error when I try and run it. I have restarted the application, and reinstalled it, but nothing is working. This error keeps coming up in my MoviePlayer_Prefix.pch file. Can someone help me out?
I have had the same issue with being unable to compile project due to UIKit.h not being found + "unable to load standard library for target..."
The solution for me was very simple - to quit (CMD+Q) and relaunch Xcode. I have found out that with Xcode opened, macOS seems to have removed command line tools for Xcode because it was preparing for a update and relaunching Xcode triggered the "install additional components" update and it made the problem disappear.
Like Faul Textor said, most likely your XCode updated to 12.1 but your Command Line Tools didn't. You need to quit XCode completely and then start it again and you should get a pop-up saying "Install Additional Components"
Sorry, this should have been a comment to his reply but I cannot do that.
It sounds like you removed the UIKit.framework from your project at some point. Check if it is listed in your project navigator. If it's not there, go to your project in the project navigator pane, select your target, go to the build phases tab, click on link binary with libraries, hit the plus button, find the UIKit.framework there and add it to your project.
EDIT:
This answer suggests that there mayb be an issue with your framework search paths build setting. Check that out and if the path is empty and it still doesn't work, a re-install of Xcode would fix it, I think.
Just wanted to add my two cents on not making a dumb-ass mistake - came across this answer hoping to solve same problem.
Turns out I had written #import "<UIKit/UIKit.h>" instead of #import <UIKit/UIKit.h>.
Thought I would add in case someone else makes a simple mistake like me.

Refactoring Problem XCode 4.0.1

So i was trying to refactor the name of a class in XCode following the steps in my text book. I'm sure I'm doing everything right and I downloaded XCode off the App Store. Basically, whenever I right-click -> refactor -> name -> preview, xcode crashes. Here's the error:
ASSERTION FAILURE in /SourceCache/DVTFoundation/DVTFoundation-227/Framework/Classes/Utilities/DVTTask.m:208
Details: The launch path must be set before launching.
Object:
Method: -launchRunningTerminationHandlerOnQueue:error:terminationHandler:
Thread: {name = (null), num = 15}
Hints: None
Any Ideas?
Thanks
P.S., sorry, i dont know how to using the quotes
EDIT: Fixed. I reinstalled with the package in side resources under "Show Package Contents" -> Resources -> XCODE and IOS SDK
If Xcode itself crashes, that's a bug in Xcode and you should report it. Using the Refactor command to rename a class definitely works at least some of the time -- I just tried it twice with Xcode 4.0.1 and the preview comes up with no problem.
I'd suggest creating a new project and trying the Refactor command there. If it works and doesn't crash, then your existing project may have something to do with the problem. If it doesn't work, that might suggest that the problem is related to your Xcode installation or machine configuration. This is just an attempt to help you find a way to work around the issue, though... Again, if Xcode is crashing, then there's a problem in Xcode.
Workaround:
Quit and restart Xcode before every attempt to use 'Refactor'.
For me on Lion running Xcode 4.4.1, a Refactor causes a crash every time if I've been doing any work. Even the simplest 'Rename' operation results in a crash.
If I restart Xcode, and make my first operation a 'Refactor', it works every time.
Further tip: It's a good time to make a backup, while quit before running a Refactor.