red group name color - ios

Xcode shows group name with red color.
How to remove this or make it normal
I am using Xcode 9

Basically this problem occurs when folder miss match with original path
Step 1 Select red folder/group
Step 2 Select file inspector from right panel of Xcode and click Folder icon
Step 3 Choose correct path and enjoy...

Use Below Steps:-
In Xcode Right click on Feed -> Show in Finder -> Copy all content
In Xcode Right click on Feed -> Delete -> Move to Trash
Go in Show in Finder where you have to create folder -> Create folder with name Feed -> Paste copied content -> Drag Feed folder to Xcode.

Related

Can't open Project in Xcode

project.xcodeproj shows red color, how to resolve this issue
I think you have the merge conflicts in .xcodeproject file.
Click on right mouse button on file
Show package contents
Open project.pbxproj file in the text editor and find all places with
merge comments
as #Erik Godard commented (search for ===== to identify the conflicts)
Remove them
Restart Xcode with your project

Xcode 7 doesn't show images added

This has to be the worst bug I ran into with Xcode 7.
In previous versions of Xcode 6 or below, if I needed to add my pngs, jpgs to a project then I would do Xcode -> File -> Add files to Project -> select a folder where I had all my images in and add that. I was then able to use those images using code
NSString* headerStr =[NSString stringWithFormat:#"button_black.png"];
UIImage *myImg = [UIImage imageNamed:headerStr];
NSLog(#"myImg: %# ...", myImg);
Now check this out, if I try to add my pics folder in Xcode 7 it shows up blue. Why is it blue? If I try the code above then nslog displays
myImg: null ...
I mean what is going on? It never displayed any of the images I added.
Just for the heck of it I deleted that blue folder and created a new folder in my project by doing right click -> New group and then added all the pics to it and then it works. Is this a monster bug with this great Xcode 7?
Because you are adding your folder as reference thats why its shown in blue.
Delete the "pics2" folder. And try to add the folder again inside the project and select below options.

Changing the folder name in Xcode

Is it possible to change the name of target ? For example, as shown in image, "Wonder Cars" to "Anything Else"?
Yeah you can change the name of the Target by doing the following Steps...
Select the new target in the TARGETS list. Press Enter to edit the text and put a more appropriate name.
Next, go to “Manage Schemes…”, select the new scheme you created in step 1 and press “Enter”. Make the scheme name the same as the new target name (which is the one you choose for the new target.)
Click on your project (in your image, the "AccessBox" entry in the list). You might need to open the left sidebar in the project settings: you have a kind of "tab bar" with entries like "General", "Capabilities", "Info", etc. On the the left side of this bar is an icon that like a square with a thick line at the left side. If you click that, a list of your targets appears.
In that list, simply click on a target, then click it a second time like you do in Finder to rename a file.
Please try with below step -
Click on your target and create new scheme from old one .
Or
You may go to Manage Scheme and create duplicate one from old target
Select the folder you want to rename
Right click on it to show a quick menu, and select "Show in Finder"
Rename the folder name as you want (select the folder, press return).
After renaming, the reference in Xcode will looks like deleted in red color. Select that folder again, CmdDelete to remove the reference ("Remove Reference", not "Move to Trash"). Then press OptCmda to add back your renamed folder there again.
Btw, #shruti's solution below
You mean to say you want to change the name of the group. click it once then click it again but not too fast give a little gap between two clicks or click it once then in the file inspector you can change the name
will only rename it in Xcode, but the real folder name won't be changed.

Copy image in to xcode

I had an image in my project which I removed (remove references) due to not needing it.
It transpires that I actually do need it, however now when I try to copy it back I get the following error - even though the image is not in my images folder any more - how is this fixed?
Thanks
Open the folder (in Finder) that your app is contained in. A shortcut is to right click on an object and choose "Show in finder". Once you're in the folder, hunt around for an image named "962-puzzle-piece#2x.png". When you find it, delete it (drag it to the trash).
When you 'remove references', Xcode leaves the image in the project folder, and simply doesn't show it to you. Then when you try to add an image of the same name, it fails because there's already an image by that name in the folder Xcode tries to add it to.
You can avoid this entirely by selecting "Move to Trash" in this dialog when you delete things:
Right click on the folder -> Show in finder.
Then drag the real file to the trash.

Images not showing on iPhone device

(Xcode6, Build for iOS7.1, iPhone 4S, Swift)
Images are showing in the simulator, but not on the device. I've been fiddling and hacking away, trying to find the magic formula, but no luck. Here are my efforts to date:
Filename: abc#2x.png, abc.png.
Dragging an imageview onto storyboard and specifying file name via "image" drop-down menu in "Attributes Inspector."
All characters in file names are lower case.
Dragged and dropped files into images.xcassets folder
Verified that images.xcassets the "Copy Bundle Resources" section in "Build Settings"
No luck. Deleted files. Re-added using the "+" button at the lower left, and selected "Add files to myProject"
Checked "Copy items if needed."
Checked "Create Groups"
Verified that files were in the "Copy Bundle Resources" section in "Build Settings"
No luck. Deleted files
Re-added using the "+" button at the lower left, and selected "Add files to myProject"
Checked "Copy items if needed."
Selected "Create Folder References" radio button
Verified that files were in the "Copy Bundle Resources" section in "Build Settings"
No luck. Deleted files
Went into the GIMP and changed file format to .jpg
Repeated steps above with the .jpg file.
Dragged new imageview into the view controller, and set the image for this container using the drop-down menu.
Still no luck
Deleted app from phone several times to allow for a clean install.
Still no luck.
Project -> "Clean"
Project -> "Build"
Restarted Xcode
Still no luck.
Any ideas?
If anyone needs me, just look for the guy banging his head on his desk. :/
Your image is taking some other image reference also, Change the image name with any another name then you try with latest one.
abc.png to a.png
abc#2x.png to a#2x.png
I am sure it will solve your problem.
I got it working, albeit not the way that I wanted it to. I dispensed with the storyboard approach, and just set the background with code.
For posterity:
I. In storyBoard, delete the reference to the image in the Attributes Inspector. There must be some bug in there. It's not working, and it will break the code below.
II. Create an IBOutlet from the Image View to your controller. You have to do that wire ctrl+drag and hold thing. You should end up with something like this:
#IBOutlet var cheese : UIImageView = nil
III. In your viewDidLoad() routine, set the image programmatically, like so:
override func viewDidLoad() {
super.viewDidLoad()
self.cheese.image = UIImage(named: "cabotClothbound.jpg")
}
Of course, you have to make sure that all the stuff in the original question is done: make sure that your case is consistent, be certain that the files are added to your build, etc.
The .jpg file which was dragged n' dropped into the Images.xcassets is the one that worked.
I had the same issue but solved it. The image (in fact, icon) shouldn't be in the Reosurces.bundle, but in the Assets.xcassets.

Resources