I've been compiling and using the following code since iOS 4.0:
if(UIGraphicsBeginImageContextWithOptions != NULL)
{
UIGraphicsBeginImageContextWithOptions(drawCopyFS.frame.size, NO, 0.0);
}
else
{
UIGraphicsBeginImageContext(drawCopyFS.frame.size);
}
As soon as I switched to 4.3 SDK, this particular piece of code stopped compiling with the following two errors:
'UIGraphicsBeginImageContextWithOptions' undeclared (error on line #1)
Implicit declaration of function 'UIGraphicsBeginImageContextWithOptions' (error on line #7)
Anyone have any ideas why this is happening? Is something changed in 4.3, or how can I fix this?
Xcode doesn't color UIGraphicsBeginImageContextWithOptions the same way as it does UIGraphicsBeginImageContext and at the same time it doesn't provide any quick help for it.
First make sure the Base SDK is set to use the latest in the Project Info. If that doesn't work then read on.
I had a similar problem with UIBackgroundTaskIdentifier which was introduced in 4.0 and compiled fine before the SDK update. It turned out that Xcode was attempting to use headers from the iOS 3.2 SDK. The console output of the build process showed the old headers search path was passed into the compiler even though the Base SDK was most definitely set to the lastest in the Project Info.
Reloading the project didn't help. Restarting Xcode had no effect. There are reports that manually editing the project file has been necessary with past updates. However, when I opened the project file in a text editor I found the SDKROOT variables were correctly set to the latest SDK path.
What worked in my case was closing Xcode, restoring the 'MyProject.xcodeproj/project.pbxproj' file from source control to a point just prior to updating the SDK, then restarting Xcode and opening the project.
I was having the same problem with that symbol and also a bunch of other symbols, selectors and macros. As with the other responder, cleaning everything and removing pre-compiled headers didn't fix it. Nor did changing the SDK. What did fix it is switching from a simulator build to a device build, and then switching back.
Related
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
Not true for all new iOS 5 methods but I've found out that calling UINavigationBar's setBackgroundImage:forBarMetrics: method will trigger an 'instance method not found' warning if the deployment target is under 5.0. This is even though I am linking with the SDK 5.0.
More importantly the enum UIBarMetrics used as a parameter there is reported as an 'undeclared identifier' and this will trigger a compiler error.
Any idea why this is so? I realized the code will not work if the deployment target is under 5.0 but I'm checking if UINavigationBar responds to that selector at run time, so everything should be ok. I don't understand the compiler error though.
EDIT:
This only happens when compiling for a device, and when a device is actually plugged in (the device I've tested with runs iOS 5.0.1).
Well, I figured out the mystery. I manage to fix the problem by deleting SDK 4.3 (I had that one copied over from Xcode 3 since it doesn't come by default with the latest Xcode+SDK package and I was using it for another legacy project).
I still can't explain why having both SDKs caused the error since I was clearly compiling with the latest SDK.
I tried Xcode 4 a bit. Found it frustrating and am currently returning to Xcode 3.2.6. But now my project can't find any of its frameworks. How do I fix that?
I had similar issue when I moved from 3.2.5 to 3.2.6.. all framework became red, not found error.
I tried restarting xcode, changing base sdk, etc, and didn't seem to fix it :(
To fix this, I had to do below (from some thread online, can't find the source now).
1) go to your project directory/proj.xcodeproj (proj is your project name)
2) open up project.pbxproj file, using any text editor
3) search for "SDKROOT =", and modify it to point to your framework directory.
For me, I had to edit them to: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/
Save your pbxproj file before you modify it, as just in case.
have fun!
Try changing the Base SDK project option to something else than it is now, restarting XCode (might not be necessary) and changing the aforementioned option back again.
It happened to me before (in Xcode 3) a few times while moving project between different Xcode versions (even with the same iOS SDK).
So I am working on an app that was compiled on sdk 3.2 and 2.2.1, but I have sdk 4.0. When I compile it, I get many build errors "Pattern colors not supported by the iphone SDK for iphone OS versions prior to 3.0" and "setText is deprecated."
Furthermore, when I open a nib file and try to change the colors, add in an item from the library, or mess around with it my changes and additions don't show up during runtime. I am thinking this is an issue with the interface builder, particularly the different SDK versions.
Is this the case? I am programming for the ipad, so I need at least 3.2?
Open the .xib file in Interface Builder, then select Window > Document Info, select a later version of Deployment Target OS version.
Your errors of "setText is deprecated" is an error in your code because apple updated their framework. The easiest to fix that would be to check the framework for a comment that says what to use.
When you make a change to a nib file, interface builder and Xcode require that you save before building the project.
The iPad is only 3.2, so yes you will need to build it for iOS 3.2.
Sorry I am OP, had to create an account since I was using a temp one.
Thanks for the answer, however, I'm not too worried about setText is deprecated because it builds successfully.
Regarding the nib file, I did save, clean and rebuild the project. I'm working on someone else's code done in earilier sdk's, and when I delete their objects in IB the app will still run fine, as though the interface builder is not responding. I add objects in the nib and they won't show up. If I do this is projects I create, it goes through finely. My guess is it's the different sdks?
When I switch the Compiler Version to Clang llvm 1.0 in existing projects I get the following build error when Precompiling the *.pch file:
error: can't exec '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2' (No such file or directory)
Is there another setting I need to change to get my project to work with the new compiler?
(I did try a clean all targets)
Update:
To clarify:
Since the new compiler does in fact work with new projects, the issue is not that my system is missing anything.
Additionally, Xcode should not even be trying to find llvm-gcc-4.2 as the whole point is that I switched from that compiler to the new one, Clang llvm 1.0. This is what has led me to believe there is still another setting to be changed.
Thanks to fbereto for his suggestion. The actual answer lies in the comments.
If you look in path specified by the error you will not find an LLVM compiler (llvm-gcc-4.2) for the iPhone device:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
That being said one does exist for the iPhone Simulator:
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
All this to say that while it may be possible to compile your iPhone App under LLVM for the Simulator, no equivalent tool exists for the device itself.
(Answer detailed in comments below.)