iPhone + OSX targets on the same project - iphone

I created a project with two targets, one for iPhone and another for Mac OsX. They both build and run well when I build them the first time (I built the OsX target first then iPhone target next).
However, if I build the iPhone target and switch back to OsX target, the OsX target now thinks that it uses the iPhone SDK rather than it's own mac OsX SDK, and doesn't compile anymore (can't find the OSX SDK header files).
My build settings of the project and targets are setup correctly and the ".pbxproj" file is not changed in the process of switching targets. But I tracked down the problem to the ".pbxuser" file, specifically in the parameter "activeSDKPreference =".
Basically when I switch to iPhone target this parameter gets changed from macosx10.6 to iphonesimulator4.0, but when I switch back to OsX target it stays on iphonesimulator4.0. The only way to get it to work again is to close the project, manually change that param to macosx10.6, and reopen the project. This would solve it until I switch to iPhone again.
Is it a bug in XCode? anyone has a solution or a work around?

The same question is asked and answered at http://lists.apple.com/archives/xcode-users/2010/Oct/msg00132.html
It says there: "you can Opt-Click your "Overview" combo box ([in the] Xcode Project [window], in the toolbar). You should see a more complete list of Active SDKs; pick an explicit OSX SDK".

it is a bug in xCode, so you use the latest version of xCode

when you build this it set all your target. you can solve this by clean all target than build it. you wil find this in xcode build manu >> clean all target. than build this. it will work.

Related

iOS simulator only list the latest iOS version. How can I set earlier versions

According to the documentation should be able to choose which iOS version the simulator should run, however only the latest 4.3.2 is listed under "Hardware/Version".
The helps says:
"To set the iOS release used in the simulation environment, choose Hardware > Version, and choose the version you want to test on."
I don't want to support 3.x (although it would be nice) but at least I want to simulate my app on 4.2, 4.1 and 4.0.
What's going on? Why aren't they listed?
UPDATE:
I'm on Lion so I cannot install an earlier version of Xcode. Before my Upgrade I could test different versions easily.
the problem is that you have no other Simulator SDK installed which can be used. As #dorada has mentioned you have to install an older Xcode which in fact doesn't work because you're using Lion. I haven't tried it with Lion but principally it should work like before with Snow Leopard.
I'm referencing to my other answer how to get an older Xcode (don't know if it's still working)
After you have an older Xcode version, mount the image an navigate with terminal to that volume. There should be a hidden folder Packages. open that folder with open . and locate the two .pkg files you need (e.g. iPhoneSDK4_0.pkg and iPhoneSimulatorSDK4_0.pkg) and install both.
They will appear in your root directory and you have to move them to your Developer dir (don't simply overwrite, it will delete all other SDKs. go to the last different folder it should be iPhoneSimulator4.0.sdk\ and copy that one)
DONE (and at that point I have verified it: it works on my Lion. I used the dvd image which I have started backup'ing since 3.2.1)
Although iPortable has the correct answer I decided to post a step-by-step guide which is easer to follow:
Download Xcode 3.1
Mount the dmg file
In Finder menu select "Go\Go to folder" and enter "/Volumes/Xcode and iOS SDK/Packages"
Install the simulators you need (Double click)
Copy the simulation folders from /Platforms/iPhoneSimulator.platform/Developer/SDKs/ to /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
If your have some SDK missing Install the missing SDK from "/Volumes/Xcode and iOS SDK/Packages" and copy subfolders from /Platforms/iPhoneOS.platform/DeviceSupport/ to /Developer/Platforms/iPhoneOS.platform/DeviceSupport/ (for me they were all there from 3.1 to 4.3)
you may download the older ios sdk / xcode from . https://developer.apple.com/downloads/index.action
(i found this answer in another stack overflow topic actually, but now i can not seem to find that question!)
Open Xcode and in the menu at the top left, where you select what device to run on, click "More Simulators..."
The download section of Xcode preferences will open,
Click the "Components" tab.
You will see a list of simulators that can be installed, click install on version you need.
The simulator will need to restart to install.
To run the newly installed version of the simulator just select it from the run menu in Xcode.
You actually have to install previous simulator versions, they aren't there on a new install.
Maybe you can search and download them somewhere? - we keep them on a shared drive at the office.
After installing the Xcode 4.2 for Snow Leopard, I noticed there was a choice for iPad 3.2 Simulator, but using it just brings up some alerts that say "iOS Simulator could not find the SDK. The SDK may need to be reinstalled." and another alert that says "Simulated application quit. Click Relaunch to try again." with Quit, Switch SDK, and Relaunch buttons.
I can successfully use iPhone 4.0 Simulator, iPhone 4.1 Simulator, iPad 4.2 Simulator, etc up to iPad/iPhone 5.0 Simulator, but really would like to have iPad 3.2 Simulator and iPhone 3.1.3 Simulator and earlier down to 3.0 if possible.
Our apps generally run all the way back to 3.0 and we occasionally receive bug reports from earlier iOS users, and would love to be able to debug these issues more effectively.
I tried the technique summarized by Tibidabo and although I am able to copy the simulator folders as mentioned, and though they show up as choices in Xcode, I cannot get them to actually run as simulators and I get the same problem alerts mentioned above.
What are other developers doing to support debugging of older iOS versions?
Go to Project Settings -> Summary an change Deployment Target.

Target integrity - mac os deployment target newer than sdk warning

i was add a new target in my existing project.
Everything work fine, but... this warning is become.
Mac OS X Deployment Target '10.6' is newer than SDK 'iOS 4.2' in target snow iphone
Anybody knows how i can disable it?
XCode4 is different and I had trouble finding this option. Here is how to do it - to access the Base SDK for the project, select the project (blue xcode icon) in the navigator top-left; select project properties (not targets) in the next pane; then select "Build Settings".
I tried to post a screenshot but apparently I need to earn more "reputation points" first...
I know this is an old question, but I ran across the same issue and want to provide help. The warning means your version of Xcode is using an SDK older than your deployment target. For example, you have Xcode 6.2 but are deploying for iOS 8.3. You would need to update Xcode to version 6.3 to resolve that error. Another option is to simply download the SDK manually from the Apple Developer center.
Right-click on your target and select Get Info. Go to the Build tab and ensure that the Base SDK setting is Latest iOS.
go to target settings and make sure that Base SDK is set to the latest one. Also check the deployment target.
I hit this problem when I accidentally opened my older version of Xcode. If you have 2 versions of Xcode installed on your computer, make sure you are using the one you intend to! The older version won't understand a newer deployment SDK.

Base SDK missing - red .app portion?

I am reading the provisioning profile stuff on the app store website and am having a heck of a time figuring everything out. I have my distribution certificates and everything but I think that something is massively messed up in xcode. When I switch to my distribution profile in the overview pulldown - it immediately changes to "Base SDK Missing". AND - when I scroll down to the projects portion on the left side - my .app file is red? Very confused.
The .app file is red because it hasn't been built yet for that specific set of build settings, which is normal behavior. The error is the "Base SDK Missing" message.
Have you installed multiple versions of Xcode? Are you perhaps editing a project with Xcode 3.2.3 that was created with an earlier version of Xcode? Xcode 3.2.3 only ships with the iOS 3.2 and 4.0 SDKs, meaning if your project was targeted for iOS 3.1.3 (for example), the new version of Xcode wouldn't have the correct SDK installed to build, resulting in that error message. You can try changing the "Base SDK" setting of the project to 3.2 or 4.0, make sure the correct "Configuration" option is selected from the drop down.
Distribution file is just for when you want to build for the AppStore, in which case all you can do is build the .app file (which is stored in the build directory of your project folder). You cannot run or debug that version of the app on a device since it is codesigned by Apple specifically for release in the AppStore only.
If you're just testing the waters or working on tutorials, try out the "Debug" option so you can install it on the device (iPod Touch, iPhone, iPad) in which case the provisioning profile is used to allow you to run the app on the device.
You can use whatever SDK you want via the same drop-down menu for the overview pulldown (i.e. 3.0, 3.1.3, 3.2, etc). You can also change this option in the Project settings menu for both the target and the project settings. There is a section called "Base SDK" in the Build menu I think.
The .app file will be red there in the project tree so don't worry about it and you'll never really need to do anything to that file in XCode. Just realize that it builds the actual .app file in your project folder in the Mac OS Finder.

xcode 3.2.4 (sdk 4.1) unable to install to device

I recently installed XCode 3.2.4 to my machine. This comes with iOS SDK 4.1. Annoyingly I can no longer install my app to any iPhone. The option to tick "Device" in the drop down for where to install to is present, but when I click it, it doesn't become ticked. Strangely I can only run my app on the simulator, despite the option to select the simulator not being present.
Does anyone know how to fix this or what might be the problem?
Thanks in advance,Tristan
Alrighty, I'm answering my own question.
What I didn't realise is that there's seperate build configurations depending on wether you click 'info' while selecting your project's title or the project's Target. I had set the project one to SDK 4.1 but not the Target one.
Did you set the iOS Deployment Target in your Debug or Release Build Settings to match the OS version on your iPhone? Did you set the Targeted Device Family to iPhone?
All these questions just remind me that something is very confusing in xCode.
And don't let me start talking about all the provisioning misunderstandings

Missing frameworks after upgrading to Xcode 3.2

I upgraded to Xcode 3.2 and now can't seem to add a number of frameworks, specifically the media player. A number of frameworks do not show up on the "Add Existing Frameworks Sheet".
Per another question I tried setting the "Framework Search Path" to
$(SDKROOT)/Library/System/Frameworks
but that didn't seem to make any difference. The UIKit.framework that is included by default when I create a new project is in
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks
which I would expect. If I navigate to that directory I see the MediaPlayer.framework and can drag and drop it into my project successfully, but can only build and debug for a device-no suprise there, but not ideal.
I uninstalled the dev tools with
mode=all
and reinstalled Xcode, but still no relief. Any help would be greatly appreciated.
Your project was probably configured to use an older SDK that's not included in the Xcode 3.2 + iPhone SDK package. Go to your target's Get Info panel, Build settings, and set the Base SDK to an SDK that's actually installed.
If you want your app to run on older iPhone OSes, set the iPhone Deployment Target build setting to the earliest OS you want to run on.
I just had the same issue when upgrading to 3.1.2. One thing you will want to do is open your Xcode Project, right-click on the project and Get Info... Then change the Base SDK for All Configurations to (the minimum of) 2.2.1.
When I did this it re-linked all of my RED (missing) Frameworks. Cheers!
I know this question is over a year old, but I just had a similar problem and solved it by looking for the missing framework in the trash and putting it back.
I must've deleted it by accident!
Possible Solution 1: Clean Your Project
Build > Clean All Target
Possible Solution 2: Make Sure Your Device is in Correct Firmware
To debug, read console log.
Hope it helps.