Xcode 3 projects in Xcode 4 - iphone

I just upgraded from Xcode 3 to 4. Have been playing around a bit first to get used to the new interface and trying to find where everything has moved to... (pfffff). New projects seem to work fine but it's definitely a large transition.
Now I tried opening some older projects but something strange happens...
ALL my projects are iPhone projects, none is for OS X but when opened in Xcode 4 it says in the left most pane: 1 target, missing base SDK. In the right pane I see: Mac OS X Application Target, everything in the Targets Section is related to OS X and NOT to iPhone.
I tried adding a target for iPhone, but still the target is missing. I then deleted the OS X target and see in the left pane: 1 target, IOS SDK 4.3 but the "Run" option in Project menu is still disabled.
I also tried this with sample files from tutorials I used in the past (eg Beginning iPhone 3 Development en More iPhone 3 development) but I have the same problem!
1) Shouldn't Xcode open those Xcode 3 projects just fine ?
2) What can I do to have the "Run" option working again ?

You need to set two Build Settings:
For Base SDK - set this to Latest iOS
For Deployment Target - set this to iOS 4.3 (or whatever the minimum SDK is that you want your app to work on.
Related to point 1 - if you hard code the SDK version here, then whenever it's upgraded, you'll likely get error messages about missing SDKs if the old one is removed

Yo have to try this
You have to select your project then in middle pane you have to select "Targets" and then go to "Build Settings" tab and in base SDK select "IOS 4.3".
Your project -->Targets(your Project Name) -->Build Settings -->Base SDK --> IOS 4.3

You need to set Base SDK and IOS Deployment Target. My Xcode 3 projects works fine after that.

If you select your project, in the editor window you get the PROJECT and TARGETS to work with.
You can set proper values their.
You may need to do more things. In Xcode4 configurations are managed using Scheme. So, Go to
Menu -> Product -> Manage Scheme,
Select your scheme, and Edit your scheme.
You may relieved off some issues there.

You need to follow both answer, set the base SDK and manage the SCHEME.some times you may not see the iphone simulator option in the dropdown list then go to Manage scheme change debug to release then you may see the iphone simulator in dropdown and change it back to debug mode.

Related

Xcode 4.3 and debugging on iOS 3.x devices

I just updated Xcode to version 4.3 via the Mac App Store last week, and discovered that I can no longer debug on iOS 3.x devices. I have the iPhone 3G running iOS 3.1.3 and a 1st Gen iPad running iOS 3.2.
On both devices it appears that Xcode 4.3 installs the app and attempts to launch the app. The app displays the splash screen but never completes booting. There are no error messages or messages of any kind in the debugger output window. My only clue is when I press the pause button I can see that the device/Xcode is stuck in the following function: addimagesToAllImages which appears to be related to Apple's DYLD.
Debugging works fine on iOS 5 devices and worked on the previous Xcode 4.2 installation. I've rebooted my Mac, iOS 3.x devices with no change in behavior including clearing out all cache(s).
Anyone have any ideas as to what's going on? Thanks for the help.
Ok, I figured it out with Junior B's hint about the debugger. I went to "Manage Schemes" and selected the Scheme I'm working on and clicked "Edit". Under the "Run" section I changed the Debugger from LLVM to GDB. Now debugging on iOS 3.x and 5.x devices work fine. Also, I left the compiler to xcode's preferred setting of LLVM 3.1.
Hopefully this helps someone else that accepts xcode's upgrade adviser recommended settings and their iOS 3.x debugging breaks.
Have you installed the “iOS 3.0 - 3.2.2 Device Debugging Support” component?
From the menu bar, choose Xcode > Preferences…, then in the Preferences window choose Downloads > Components. Find the line for iOS 3.0 support and click the Install button.
Only switching from LLDB to GDB wasn't enough for me when encountering the same problem. As I had an older working commit in git, I figured out which changes in the Xcode project setting let in my case to the error. Thus I could resolve the issue by removing all occurrences of the following line from my $PROJECT.xcodeproj/project.pbxproj
GCC_THUMB_SUPPORT = NO;
Also, I reverted the value from
LastUpgradeCheck = 0430;
back to
LastUpgradeCheck = 0420;
As I have my schemes configured to be 'Shared', these settings are also stored in the project directory (subdir. 'xcshareddata' in the project .xcodeproj directory), and thus changes also visible in git. Another change I reverted were removing these two lines in '$PROJECT.xcodeproj/xcshareddata/xcschemes/$PROJECT.xcscheme':
LastUpgradeVersion = "0430"
ignoresPersistentStateOnLaunch = "NO"
Another change in the .xcsheme file were that the values of 'selectedDebuggerIdentifier' and 'selectedLauncherIdentifier' ended with '.GDB' instead of '.LLDB', but this is actually the same as you will get by following the accepted answer from Wesley.
Those changes solved for me the problem, and I could debug again on my iPhone Classic running on iOS 3.1.3.
However, I strongly recommend the use of a versioning system like Git (or at least a local backup!) before applying these edits with your favorite text editor.
Hai MyDear Friends,
I am having one simple solution as follows:
"Xcode --> Preferences --> Debugger --> check Auto clear Debug console"
results clears the console every time You run the Application

Install Xcode 3.2.4, get "Base SDK Missing"

When you update Xcode to 3.2.4, your previously working Xcode iOS project gives you the message "Base SDK Missing". Something like this:
What gives? How to fix?
The Problem
iOS SDK 4.0 is gone in this release, replaced by iOS SDK 4.1. Details in "The Explanation" below. (NB: this repeats some information in my previous Q/A regarding 3.2.3).
The Fix
To fix this specific problem, you need to reset the Base SDK for your target(s), etc. You can either do that for the entire project (most folks), or for each target and/or configuration which applies. Rarely, you might need to do both.
Edit Project Settings
Load your project
From the menu, select Project > Edit Project Settings...
Click the "Build" tab.
Under "Configurations" select "All Configurations".
Go to the Change Base SDK section below.
Edit Specific Target/Configuration Settings
Load your project
From the menu, select Project > Active Target > "YourTarget"
From the menu, select Project > Edit Active Target "YourTarget"
Click the "Build" tab.
Under "Configurations" select "All Configurations", or the Configuration you want.
Go to the Change Base SDK section below.
Change Base SDK
Under Architecture > Base SDK, choose one of the available device
options: iOS Device 3.2 or iOS Device 4.1. If you are iPhone-only, 4.1 is the way to go.
If you want to target previous iOS versions, then in that same
window, under Deployment > iPhone OS Deployment Target, select the
lowest version you want to support. Note that support for 2.x versions
through the app store is deprecated.
The Explanation
iOS SDK 4.0 is gone in this release, replaced by iOS SDK 4.1. This is very similar with what happened with the 3.2.3 upgrade, which I covered in detail here. You can still use 3.2.4 to target iOS versions down to 3.0, but AFAIK, you must compile against the 4.1 SDK with Xcode 3.2.4. If this statement confuses you, study the following sentence closely:
The iOS SDK you compile against -- the "Base SDK" -- does not downward limit what iOS versions you can support.
In fact, there are two different settings, cf. Change Base SDK above. If you remain confused, take heart, and read my detailed post on the previous switchover, which is itself chockablock with links to good stuff.
I ran into the same problems for 3.2.5 and followed the same instructions. It didn't work for me, but I noticed that new projects would work properly. When I grepped ShareKit.xcodeproj/project.pbxproj, I noticed that there were still stray references to iphoneos4.0 in the file for SDKROOT param even after changing it in xcode. Manually editing this file and changing all references of SDKROOT to iphoneos fixed the problem. Hope that helps someone.
For all older projects, select the main window, select Option-Cmd-E, choose build and "latest ios...".
Close the build window.
In the main window, option-click the dropdown for Base SDK and you should see the latest build available.
It's still a pita, but it's easier than navigating, closing windows, etc....
If anyone knows a better method, I'd be happy to hear it...

There is no SDK with the name or path "iphoneos4.0"

I download a sample of UICatalog and run it.When I compile it ,it shows the failed message:There is no SDK with the name or path "iphoneos4.0".I find the "Base SDK" of UICatalog's Targets is iphone Device 4.0(missing).How can I solve this question and run it.
Thank you!
Select the root level of the project, in "Groups & Files". It's blue. Then hit command-I to get its Info.
Pick "Build" from the segmented controller at the top of the info window. In the first section of that panel you'll see Base SDK as one of the first few lines of options. Select the latest version of the SDK you find in there, and close the window to save your options.
Build-and-run the project, and you should be good to go.
EDIT, because I see from the comments that people are finding this answer who have a slightly different question than the OP's, so here's one other thing to try. It could also be you have "iOS Device" selected as your build target. If so, and if what you really want is for it to launch into the simulator, select "Simulator" instead.
After loading the project into XCode..
Under Groups and Files
right click on UICatalog<-(or your demo project name) and select Get Info
in Base SDK select IOS Simulator 4.1
Close and save info pane
expand Targets exposing UICatalog<-(or demo project name)
right click on UICatalog and select Get Info
in Base SDK select IOS Simulator 4.1
Combo box in UICatalog project pane (upper left corner) should switch to "Device - 4.1 | Debug" instead of "No Base SDK"
if you Build and Run at this point you might get another error. If so, open the UICatalog combo and switch from Device to Simulator
The "official link" mentioned above states…
"Note: Targets can override build settings defined at the Project level. "
..but should probably read "will" instead of "can"
Ok, I've solved it.
In Groups & Files go to Targets and select your target.
Press Ctrl+I (or open the info in some other way)
Set the Base SDK of your target
(The Base SDK should also be set at the project)
Steve nailed it. This is an Xcode bug. I loaded the NavBar sample and Xcode didn't even offer the simulator as an option, and it complained about the missing SDK even though it was set correctly in the project and wasn't set at all on the target.
Do what Steve said:
"The only way I could resolve it (in fact, the only way I could get the option of running in the simulator at all) was to change from debug to release and back. The dropdown still shows Base SDK Missing but if you click it, the simulator options are there and it builds."
My problem was that in the sample code another xcodeproj was embedded. So I looked after that file with Finder, opened it with Xcode and than the same as Dan said: Project -> Edit Project Settings -> Under "Architectures" set Base SDK to "iPhone Simulator x.x" (the latest one you have installed)
I had the same issue with another Apple sample app. The only way I could resolve it (in fact, the only way I could get the option of running in the simulator at all) was to change from debug to release and back. The dropdown still shows Base SDK Missing but if you click it, the simulator options are there and it builds.
I think that's a bug.
Many answers here, none seem to be complete enough about this, and it's all a mess. But they are all helpful. Here, I just want to compile all helpful pieces in one answer. Thanks to Larry (who have almost everything compiled into steps already), Steve, Dan Ray, dkk, geowar and lqf.
This picture from apple is a little decieving and outdated (talking about iOS SDK 4.0 and we're currently at 4.1) but it does show where you should change the project settings. Just select iPhone Simulator 4.0 if it was previously on iPhone Device 4.0.
Other than that, they say "Targets can override build settings defined at the Project level". So, yeah, also go ahead, open Targets and set all of their Base SDK back to default by pressing delete on it. If they were bolded, they'll become regular indicating a default value, which should be iPhone Simulator 4.0 if you did the first step right.
Just realize there are many places where Base SDK can be wrong:
Under Project Info
Under Target Info
Under different configurations for both Project and Target
And that under Target it should be set to default, which is value from Project.
There's still something about the overview combo sometimes having and sometimes not having more than 1 option such as "Device" and "Simulator" that I just couldn't understand yet, but this is another potential configuration place for Base SDK being wrong.
You have to make sure that you change to the "iPhone Simulator" under the project settings in the appropriate configuration (i.e. if you are building a debug build you have to change to the simulator under the debug configuration).
For some reason I was getting this error when I did change the simulator but realized that I was doing a debug build but changed to the simulator under the release configuration and not the debug configuration.
dkk's answer is what made things work for me. I had to change the Base SDK on the target and not just the project. Perhaps you have to do both.
I got a similar error after upgrading my iPhone to iOS4.2.1(8C148a). The situation is as following.
I was using Xcode 3.2.4, but it does not support iOS4.2.1. So I downloaded Xcode_3.2.5_and_ios-sdk_4.2_final.dmg which is 3.78GB requiring 9.53GB to install. Then I ran my ap with Xcode 3.2.5. That is where I got the above error message.
Now it is ok. I solve this based on Geowar's answer:
For the official answer:
http://developer.apple.com/library/ios/#qa/qa2010/qa1701.html
Please be noted that if you have done as Geowar said and the message is still there. Try to close Xcode 3.2.5 and restart it. That is how it works for me.
Another thing is that if you have just upgraded to iOS4.2.1 like me. When you try to load the a/p from Xcode 3.2.5 the first time. Xcode 3.2.5 may still give you "No provision iOS device connected". Please try to go to organizer and click on your iPhone under DEVICES on the left bar. Wait for a while to let Xcode in sync with your iPhone with iOS4.2.1. Then it will work. At least it work for me.
Jesse
Ok, so I struggled through this too. Based on some of the answers above and from the apple development forum, I was able to figure out what worked for me.
In XCODE, if you notice that the pull down at the top left of the window says "BASE SDK MISSING", you are going to get this error "There is no SDK with the name or path “iphoneos4.0”". To fix the problem:
double click on Group & Files in the upper part of the left pane of xcode. This will open a window
go to the Build tab of the new window
click on the row that says "BaseSDK" and select "Latest iOS (currently set to iOS 3.2)
The Configurations pull down near the top should now say "All Configurations". If not, set it.
close the window.
Now if you try to build, you will get a different error, something like: Code Sign error: The identity 'iPhone Developer: x Xxxxx' doesn't match any identity in any profile ...
So, now what you need to do in xcode is to click on the pull down in the upper left corner (the pull down that had the original BASE SDK MISSING indication, but probably has something different now), and make sure that both "Simulator" and "Debug" are checked as options in the pull-down.
now you should be good to go.
I just went Project -> Edit Project Settings -> Build -> then change the Base SDK to iPhone 4 simulator or I'm assuming whichever SDK you want to use.
I never had to specify the build for a given target, although my program was created on a mac that was already configured to use the iPhone 4.0 simulator.. so perhaps the targets were set for the simulator SDK and the project itself wasn't? Either way... just glad it works.
I was having the same problem and what I did to solve it was:
Go to Menu Project
Go to Set Active SdK
Select the option SIMULATOR instead of DEVICE
Build and Run and the ERROR has gonne!
I hope it works for you guys... =)
I just had a situation where I changed the Base SDK to 4.2 on my project after updating to Xcode 3.2.5, but I kept on getting the "There is no SDK..." error. I finally opened the project file (MyProject.xcodeproj/project.pbxproj) in a text editor and looked around. There was no mention of 4.0 anywhere, only 4.2. BUT when I then saved that file, it all started working in Xcode. Perhaps some permission on the file or something else. Have no idea really, but it worked.
I got this error when one of my configurations still referenced an old (iOS) SDK. Note that the error shouldn't have come up when I tried to build a totally different configuration (with correct Base SDK setting), so this smells like an XCode bug to me.
People suggesting that you don't set the base SDK in at target-level have probably never created projects which contain targets for different platforms all in one project file (in my case Mac and iOS targets, so setting the base SDK once in the project file is nonsense advice).

iPhone framework paths?

I recently moved my projects to a new mac, along with a newer version of Xcode.
When i opened my project i noticed that some files were red. So i remapped them by setting the path (by project path) and then providing the proper path location.
Now my problem is that the frameworks that i have are red, and i cant find their location! I did set the framework paths to be "relative to current SDK" however.
Can anybody help me get my frameworks mapped correctly?
The frameworks im using are:
- QuartzCore.framework
- libsqlite3.0.dylib
- UIKit.framework
- Foundation.frameowrk
- CoreGraphics.framework
The XCode version is 3.1.4 (the only one installed).
The iPhone app was originally created using a prior version of Xcode (i dont remember which version).
I still dont have an answer. Im going deeper into this mess of a problem that Apple created.
In all my .m files im importing
How can i add this UIKit framework to my project Target with respect to the current SDK?
In fact, forget about the ref w/ respect to the SDK, let's just get the framework from the 3.0 SDK as a referenced framework. Right now when i reference it is red.
Note: references related to frameworks, everything about it, is driving me insane, and making me more frustrated at apple for this sloppiness, more than ever.
Any help is greatly appreciated.
I had exactly this problem. Somehow 'Base SDK' in Build Settings of a project was set to Mac OS X after I have installed Xcode 4.2.
Click on your project, change Base SDK to 'Latest iOS' and enjoy the vibe.
If you double click on your target to bring up the info pane you will see a tab labeled "Linked Libraries". From here you can click the plus button to add the libraries and xcode will do the right thing when you add the desired frameworks
I was having the same issue with red frameworks and bad pathing. If you're getting an error that says, "Base SDK Missing" you'll need to Get Info on your Xcode Project and check that it can find the right SDK.
Near the bottom of the General Info tab there will be an option Base SDK for All Configurations. Select a different SDK and see if that helps.
I ran into issues when I upgraded to a beta SDK and it was loading up deprecated frameworks from an old SDK.

Adding SDK-specific frameworks to Xcode

Xcode 3.2 kind of broke the build process of my iPhone app. I need to add a new framework to my project (MediaPlayer.framework).
So I go into my Target settings and try to add it to the "Linked Libraris" by hitting the [+] button. In the list the MediaPlayer.framework is missing, as well as other frameworks, such as UIKit, CoreGraphic and others. Some frameworks are still there.
I can add the frameworks by adding the SDK-specific ones (going into /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/) but then of course I can only compile for the iPhone platform and not for the simulator any more.
So basically I wonder how I can get Xcode back to chose the appropriate framework, depending on platform and SDK version for me?
Thanks and kind regards, Hans Schneider
Edit: Things I tried: Setting the Base SDK to 3.0 (was still 2.2.1), reinstalling 3.0 iPhone and Simulator SDK from the "packages" directory of the Xcode 3.2 DMG. Didn't help. The frameworks still wont show up in the list...
Edit 2: Ok, I now have the frameworks back in the list, I was previously in my AdHoc configuration. In Debug I have the frameworks back. But it still wont compile for the Simualtor (lots of Symbols(s) not found errors).
Looks like the linker doesn't choose the correct libraries and always uses the iPhoneOs3.0 path for the frameworks.
Goto 'Framework Search Path' in build section in target's property.
Add path:
$(SDKROOT)/Library/System/Frameworks
Then it should work well.
And once you press 'OK', you should be able to see the path is set to '/Library..."