What is the purpose of Product -> Clean in Xcode? - iphone

What does it do exactly? Can't find an explanation in plain language

Basically it erases all compiled components, so the next build will build everything fresh. This in theory should never be necessary, since we all know that IDEs are perfect and totally keep track of all source changes and hence know precisely what components need recompiling/rebuilding at any given time. (But, of course, such perfection seems to be a bit elusive.)
The concept of "clean" is found in most IDEs. You use it when things are behaving strangely, or in certain known cases where a "clean" rebuild is required.

A very important usage for "Clean" is when you have images in your application and you update their contents without changing their name. For example say you have an image named Background.png that you used for a while, then you edited this picture in Photoshop and saved the new one in the same name. On the next run of the app the image will not be refreshed; the compiler will continue to show the old one. To make sure to see the updated image you need to do "Clean" before you run. So in principle on all image updates where the name did not change you need to "Clean".
By the way, you might need to "Clean" once for the simulator and once for the real device run. One final note, don't have the idea in mind that every time you write code that you think should work but don't work as you expect then the solution is "Clean", in such a case it is always a problem in your code which needs revision.

Related

Android/Eclipse - How save working copies? Versioning?

New to Eclipse, Android and Java, so this is sure to be a real newbie question...
I'm working on a simple project (say, display a button) and get it working in the emulator. All is good.
Now I want to add a second button to my stunning app, but want to make sure if I horribly break the code, I can go back to my first working code and try again. I don't really see a way to do this without creating a whole new project. This seems kind of crazy, since I like to save the working versions pretty often so there isn't a lot of lost work/time. Is there a better way?
Also, if this IS the way it is done, what is the best way to create a 'new' project which is simply a copy of the last working project (under a new project name)?
Thx.

Packing an Actionscript (Flash Builder) application for iPhone

Recently I tried to build a flash application in Flash Builder, and I wanted to export it to my iPhone. I have gone through all the required steps in order to certify my application.
Now, with all that done, all that was left to be done is building the ".ipa" file in Flash Builder. Now, this gives the following error:
'Launching TestGame' has encountered a problem.
Error occurred while packaging the application:
NotBefore: Wed Apr 11 18:52:40 CEST 2012
Google didn't give me a decent answer, nor does Adobe's information regarding mobile application development. All I can think off, is that I can't build the application before that date. That's ridiculous, I can't imagine a certain check like that.
I'm pretty sure my ".p12" key file is generated correctly.
Is anyone else familiar with this error? Please, be so kind to guide me in the right direction.
Kind regards,
Matthias.
The error occurs because the compiler didn't find the files under the corresponding directory such as debug-bin or release-bin folder. (explains from: http://forums.adobe.com/thread/893772)
For example, if you are doing a debug-build, and you didn't select the project option: copy non-embeded files to the output folder. And debug-build needs some files such as icons files under the debug-bin folder, and it couldn't find it.
Solution: select project compiling option: the copy non-embeded file to the output folder.
Try again, if still not you will need to try the ADT build to get more details http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac35eb7b4e12cddc5fbbb-8000.html
I suggest compiling from command line. I'd ported an AIR app to iOS and compiled using adt dirrectly (without FB or whatever), and there were more meanful messages then yours. Take a look at the manual on how to build ipa wit adt. The other advise is to check your iPhone node in app.xml (take a look here) and icons.
The "error" was thrown because the certificate wasn't valid yet. It became valid on the date shown above.
You could also fix the manifest file in the iOS developers center.
This problem does come up more often than needed. The error reporting is lacking distinctions but is also difficult to asses since there can be many factors causing this error. If it was one factor or even just a few then it would most likely let you know.
A great way to ensure that the error reporting can do its job and tell you where the problem is is to check your error log. It will tell you at least a few of the places that threw the block.
If you are unable to read those strange glyphs then just ensure that all your resources are being packaged. This does mean a little time of list checking but it is well worth it, for the errors and to get rid of development junk.
The first step in the asset list check is to go through each part of your Assets class (flash builder reference). If you do not have a direct Assets class then you may want to make one and move all of your asset calls to that one class - since it will save you time if this happens again.
Your Assets class is not the same as your Assets folder. Your folder is where the files are stored - i.e. images, bitmaps, sounds, etc. Your Assets class is what categorizes and assigns references to each individual file.
Go through your Assets class to ensure that each of those files exist in the folder as well. Then go to the Project menu (top near Navigate and Search) and select Clean. Either clean all your projects or check the current one. Once this is done you need to click on your Assets Folder (right click or highlight and hit edit or whatever), and select Refresh. This will check that all the files are still there and get rid of/update them.
If none of this throws an error -red X- or other errors then you need to check your project .xml file. This may take you some time to ensure that all of your add on packages and details are correct. Make sure you have the correct:
at the top and it matches your current air release.
Make sure all the filenames, names, ids, version numbers, aspect ratios, fullscreen, visible, icons, extensionIDs, and everything else are not only correct but actually there. Most of these statements should have something written and not be blank. If they are blank find out what to put in.
Ensure that you have the proper icon file extension. If it says assets/icon48.png and the icon48.png is actually in assets/pictures/images/icons/toomanyfilesextensions/whatever/icon48.png
you need to fix that link.
The last thing that you will need to check is when you want to either Release Build or Debug. You need to make sure that all assets are checked and selected.
Go to Project - Properties.
then select ActionScript Build Path.
Click the Native Extensions tab and see if there are any red X's. If there are tap the little arrow beside them and see what the matter it. Add the correct ANE or get rid of it or whatever you need to do.
Then in the same menu go to the left and select ActionScript Build Packaging. A little arrow should be beside that one too. Tap the arrow and it will open to Apple iOS, BlackBerry, Gooogle and whatever else you have (probably nothing more). Select the OS your want to use, lets say Apple, and you will have 4 tabs pop up. Make sure you have the correct certificates selected. If you have none or are confused about this you need to spend some time on Google.
The biggest one for this error is under the Package Contents tab. Most people miss this!
Open the tab and see if anything is not checked. There will 99.99% be something or many of them not checked if you are getting this error. Just check them all and you can figure out what you need and don't need later. Some of them will be listed because you just threw in a bunch of ANEs and .SWFs to have some awesome app. Those add on packages will throw in unnecessary contents into this package. That is fine and don't worry until you want to be picky. Just make sure they are all selected and hit Apply and Ok.
That's it. You should have a working Release Build if you did everything else correct and this error should be easy from now on (but time wasting).
You may get a 'slip' error now, but that is another story. But that is a great sign because you are getting closer to that stupid mistake that we all make: the elusive spelling mistake.

Xcode won't build to device

This problem has been KILLING me. I've been working on this app for 8 Months, and I am so close to finishing, I just can't seem to build for device. Building for the simulator works fine, but device always gives me the SAME 2 errors.
The 1st Error:
"Instruction requires a CPU feature not currently enabled"
From googling, I've found this probably means I'm not linking a binary I should be, but I'm not sure.
The 2nd Error:
If you can't read it, it says: Generating JWFNS.app.dSYM ... error: unable to open executable '/Users/ajr1188/Library/Developer/Xcode/DerivedData/JWFNS-azshgysfabycfagnebotitpcyaww/Build/Products/Debug-iphoneos/JWFNS.app/JWFNS'
This is the big one. I cannot seem to build the .app.dSYM file properly. I went in and deleted the build folder, I looked at EVERY stackoverflow question I could find and tried changing any random thing mentioned in another question, but all of it is to no avail. I'm so suck right now. AHH. PLEASE. Any help would be so appreciated!
Maybe your project has become hopelessly corrupted. One thing to try is to start a brand new project and copy/import all your sources/assets into the new project to see if that fixes the problem.
Another less nuclear (but perhaps more time consuming) approach is to binary search the build. Exclude absolutely everything except main.m and see if that fixes the problem. If it does, include half your sources, and buid again....repeat, trying to narrow in on the problem spot. Maybe a file or group of files has received special build settings that don't belong there.
I've had very similar problems, I cant remember the exact error message but it was very similar. Are you able to make a new project that will run on your device?
if so (and I know this sounds bad but it's worth a try) Create a new project and simply copy all the code and resources across and see if it still works. If it doesn't then there is something wrong with you code and you can continue trying to isolate the problem from there.
Hope this is helpful.
check the frameworks you link to. there's a chance that you linked a framework (say quartz) of osx, instead of ios.
Answering in detail is probably going to take looking at your target settings. But it looks like you may be building for the wrong architecture. (It doesn't link, so there is no .dSYM symbol file.) For example, if you have only recently built for device, you probably created your project under an older Xcode, and it may not have the arm6/arm7 settings right.
To check, show the Build Settings for your target (not the project), and filter on Architecture.
Make sure that in build settings the architectures are armv6 and armv7. Also make sure that in .plist file, the "Application requires iPhone environment" is TRUE. Delete "Required device capabilities" in the .plist if present.

How to change iPhone App name 100%!

Can't seem change the name of my iPhone app 100%.
I followed multiple threads and performed the outlined methods below, but the old name keeps popping back up in Console. I'm concerned that on some deeper level the app's name has not really been changed 100%.
My concern is with the fact that I've made a "Lite" version by starting with a copy of the "Full" version. So I don't want the device to get confused if my customers upgrade and download the full version and the device see two apps with the same "CORE or ROOT" name.
Console continues to output:
2010-07-03 10:56:35.129 *OldAppName* [45672.207] Test Message
I have changed the Product_name, ".app" name, Bundle name, etc... - Where does "Console" get this name, so I can truly change the app's name 100%? I don't want an conflicts with the full version down the road as the apps grown independently in complexity. (i.e. Push Notifications, iAds, and other "APP" specific items)
I have performed the following, but still not getting 100% name change:
I. I have used Xcode, Project, Rename.
II. I have used the suggested answer on stackoverflow thread, Changing iPhone App's Name, to
Go to Targets in Xcode,
"Get Info" on your project's target (your current silly development name),
Search for "Product Name" under "Packaging". Change the value of that what you want the new program name is going to be.
My "Product_Name" field was blank for all builds, I changed it to the new name, but I continue to get the console output referencing the OldAppName.
III. I'm not trying to change the "Bundle Name", those are the same, as this is a Lite Version. And changing this does not change the Console reference name anyway, I tried.
IV. I have deleted the entire "Build" folder several times to assure no legacy issues, but the name still does not change.
I'm currently working on a large copy/paste migration over to a new project to try and fix this completely with a new project, because I would like to get app uploaded to the AppStore asap, but there must be a better way of achieving this.
Where does the "Console" get this name? Does this mean that if my customers' download the full version that on some deeper level the device will get confused-(i.e. NSUserDefaults with the same names, running issue, sandbox issues, etc...)?
The names are not stored in the info.plist, they appear to just be referenced from the target, but when I search through the target, I don't even find the OldAppName, is their an additional storage file for this core information?
I would like to stay in Xcode if possible. I have seen suggestions about using other programs or trying to change the XML directly through text editor, but I don't want to accidentally leave a "Third-Party" application marker or trial that might get rejected by Apple Reviewer's as they seem to be coming down hard on this issue.
Any detailed suggestions??
I had the same problem about a year ago.
I've got really nice & easy solution for your needs. You need to click on the "superview" of blue icon (Project/Targets) and then hit enter to change the name of the project. You can also double click on that field, but you need to do it with quite a long delay between clicks.
This method will change magically name of the project in all important places.
http://i.stack.imgur.com/3f1RD.png
Only Solution that Worked, and it was the one that feared the most and was trying to avoid.
I had to start a new project and painstakingly move all 96 class files (about 27mb of text) over one by one, because dragging the classes over kept giving me an error. I tried dragging over the classes as one large group, but that would not work. A little "re-factoring", rebuilding the .plist info, and setting up the new targets, and it I got it working again. I think that there was some sort of legacy issues that Xcode was getting caught up on.
It is working now under a new project, but there must be a better way.
Have you tried opening all files in your project in a text editor and searching for the old name?
Have you tried creating a new empty project and merely adding your content and code files to this empty project?
I have done these in the past and found they work fine:
http://drjunker.org/2008/04/10/xcode-rename-project-and-application-change-copyright-and-version-number/
http://homepage.mac.com/kelleherk/iblog/C1216817469/E1454445171/index.html
I also Clean All Targets/Builds and rename the Executable after.
I had a problem when there was a localized strings (infoPlist.strings) file in project with "CFBundleDisplayName"="MyOldAppName" in it. Removing this file and renaming target to my NewAppName worked for me.

When my colleague changes code and commits it to the repository I can see the code, but xCode compiles as if his contributions weren't there

Have any other iPhone developers experienced this phenomenon? I can see his contributions in xCode - I see for example my colleague has wrapped a navigation controller around one of my view controllers and added it to my tab bar. Great! That view really did call for a navigation controller and this is a welcome addition to the project.
So, I up my code and compile - no navigation controller. I do build -> clean all targets, thinking maybe some pre-compiled code is mucking me up and compile again. Same result. I was eventually able to get his changes to compile by deleting the whole directory and checking it out from the repository, but I really don't want to do that every time my colleague checks in code.
Is there some kind of box I need to check or something? What could be causing this behavior?
Thanks in advance.
Here are a number of possible fixes:
1) Delete the current version of your app off the simulator and/or device. This especially becomes necessary when using Default.png or app icons. There are a lot of shortcuts that the compiler takes for apps that are already "installed".
2) Make sure that there are NEVER any build folders or user specific files (pbuser.USERNAME I think). These files wrecked havoc on a few projects and we basically had to delete and start over.
3) Make sure that all files are svn added to the project before each commit (although this wouldn't matter for your current problem.
4) Find the changed code and set breakpoints for the debugger to catch. I believe that breakpoints that turn YELLOW while running signify that there is a difference between run and code.
I would tend to believe that it would be a problem with the .proj file also, but it sounds like that's not it.
Some things to check (but maybe you already did it):
is the new code added to the correct target? You will still see it in the project tree, but it won't be compiled
if you are using a SVN (or CVS) client that is not XCode, you have to remember to commit (and update) the .xcodeproject file too.
Your question isn't entirely clear to me, so forgive these follow-up questions:
Where in Xcode did you see the changes? In the repository browser, or in the file browser part of Xcode?
What do you mean by "up your code"? (I'm assuming you mean that you chose the "Update source from repository" option or whatever it is called - I'm away from my mac right now - but I thought I'd check.)