Xcode including rogue files - iphone

I am currently making an application and have an issue selecting data from an sqlite database. Although this is currently a problem I am enquiring about something else.
On investigating why the I could not select data I was reviewing the files that are on my iphone for the application to ensure the database file did in fact exist however what I have found is that another sqlite file also exists.
I recognise the name of the file as it is a file that I have created in a different project.
I have tried to search for the filename to ensure I have not copied code causing it and I cannot locate that file name in my code at all.
Does anyone know why this file may have appeared in this project?
----- UPDATE -----
Since originally posting this I have come up with a couple of thoughts. iCloud was originally turned on. I have turned this off. I originally copied and pasted code that referenced the other database. I have tried to delete the file but this fails. I have also deleted the app from the iPhone and have found that the folder for the app remains but claims it is empty and has 0 bytes contained within it (the rogue DB is 116 KB). I think this might be related to the iCloud issue. I am going to restore the content and settings as a test.
----- Update ------
After resetting content and settings the file still comes back so unsure what is going on at present.

Goto the Target's Build Phase tab and look in the Copy Bundle Resources section. Most likely, the other sqlite file is in there and being distributed/installed as part of the package.

Related

iPhone File System

The MyProjectName.app should be in the iPhone App structure directory as read-only, but in the project I have to join Test.sqlite and compile it, then I see the Test.sqlite in the MyProjectName.app.
I posted the project to the physical machine and inserted some data without issues. Is this the right way?
When I add the Test.sqlite and data on the iphone simulator, the Test.sqlite didn't appear to have any data. I have tried to copy the Test.sqlite to Documents. And then when I did it again, the data was displayed in the Documents's Test.sqlite. Do I need Test.sqlite to be copied to the Documents? thank you
The resources which are modified at runtime should be part of Documents directory. iPhone application creates a sandbox environment which is signed. If you try to modify any of the bundle resource, it will not allow. It works fine with simulator but not with device.
So, whatever resources are modified should be copied from bundle to documents directory.
Also, when upgrade is available, bundle is replaced with new version. However documents directory does not change. It remains same. If you want to carry any change with upgrade, you can modify data accordingly.
Hope it helps.
Check the Test.sqlite file is it read only or read/write.Change it into read/write.And if there is any lock for the project just uncheck it.

Renamed Files Still Exist in Xcode

I'm making an iphone app that displays a random picture chosen from pictures in Resources.
I have renamed some files for categorization,
but running console shows that file with a new name and file with old name both exist as separate files.
Of course, I can't see the file with the old name in my Resource folder, nor in the original folder where the pictures are.
Kinda freaky...
How could I remove the files with old names and make it a norm to not keep another file with the old name whenever I rename a file?
Please help me out.
Thanx.
Expand your Target and remove the images from Copy Bundle Resources.
I'm not sure I understand your question correctly, but I recommend cleaning your targets from the project menu and resetting the simulator.
You can also select all the new files in XCode, right click and select compile.

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.

iPhone Documents directory and UIFileSharingEnabled, hiding certain documents

I want the user to be able to access the files in the documents directory but am using core data and dont want the user to be able to access the store (the sqllite db), can i hide it from the user while still allowing file sharing, or can i put it in another directory where it will still get backed up?
The answer given by FrenchKiss Dev is not correct. The user will still be able to see the ".data" directory in iTunes and save that locally with all the files inside it.
Instead, store private documents in Library/Preferences
According to Apple:
In addition to the directories documented previously, the entire
/Library directory has always been preserved during
updates and backups, except for /Library/Caches.
Because of this, applications can create their own directories in
/Library/ and those directories will be preserved in
backups and across updates. To minimize the risk of name collisions,
we recommend that you name this directory carefully. For example, a
directory named Private Documents would be a good choice. You should
store any files you don't want to share to Library/Preferences.
In the documents directory, create a subdirectory which name starts with a dot. For example:
.data
EDIT: Please stop downgrading this answer !
This answer was correct at the time (remember that it was before the iPad was actually available! And there was a lot of confusion on the matter, we were still hoping for the iPad to appear in the shared devices in the Finder...).
Today (April 2012) it is still working on the Mac but not on Windows (starting a directory name with a dot means nothing in Windows).
Anyway, this Shared Document feature is a mess. Later they fixed it by saying that "Private Documents" should be stored in the Library Folder not in the Documents folder. But remember that developers were already using the Document folder before the iPad came.
Don't blame me for Apple mistakes.
Stack Overflow should have a way to mark an answer as obsolete.
API changes, get fixed, and it renders answers obsolete.

Specify build folder for iphone application

I've written an app that uses some of the user's camera roll images, and while it does so it stores them in the application root directory. The problem I have is that whenever I re-compile my application it changes the folder to which the application is installed.
Is there any way I can specify which folder it should build to, so that any path information stored during it's last run will still be valid?
I don't think that this is something you can stop Xcode from doing unfortunately. It should be copying the data from the old location to the new one but sometimes that just doesn't happen.
The answer suggested in this question looks like the solution you are after.