Build error with UILocalNotification with older deployment target in XCode 4 - xcode

I have a project I am trying to build with XCode 4.1 that built fine on 3.2.5. The base sdk is set to 4.3 and the deployment target is set to 3.2. I've reproduced the problem in a simple project with the following code:
Class notificationClass = NSClassFromString(#"UILocalNotification");
// Make sure local notifications are supported
if (notificationClass)
{
UILocalNotification *taskNotice = [[notificationClass alloc] init];
[taskNotice release];
}
On the UILocalNotification line I get the error: 'UILocalNotification' undeclared (first use in this function)
The relevant settings are:
Compiler: LLVM GCC 4.2 (also tried Apple LLVM compiler 2.1)
Weak-linked: UIKit, Foundation, CoreGraphics
I've scoured Google and Apple's docs and tried everything I could find with no luck. Any help would be greatly appreciated.
Thanks,
Jason

Appears that the problem was because I had the iOS Deployment Target set to 3.2. I've set it to 3.2.1 and now it builds fine. May be due to 3.2 being iPad only but the same thing happened on the iPad version of the app so I'm not sure.
Jason

Related

<unknown>:0: error: Swift does not support the SDK 'MacOSX10.12.sdk'

I'm on macOS 10.13.3 and I created a new fresh macOS project with Xcode(9.2). Without any custom code I changed the Base SDK from 10.13 (wich is default) to 10.12 in the Build Settings of the target. When I build it I get this error: <unknown>:0: error: Swift does not support the SDK 'MacOSX10.12.sdk'. I also changed the version (Base SDK) to 10.2 for macOS Deployment Target. I also changed the two locations for the Project Settings. But it does not compile. I always get this error. I can't imagine that swift is not backward compatible. Even to change the swift version from 4 to 3.2 has no effect. Is there really no way to compile this new fresh project for SDK 10.12 or even 10.10? Any help is highly appreciated.
What I did before:
To be able to change the version of the BaseSDK within Xcode,
I downloaded the SDK's from here: https://github.com/phracker/MacOSX-SDKs. I edited the info.plist file in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer There I deleted this two lines of code:
<key>MinimumSDKVersion</key>
<string>10.11</string>

ld: library not found for -lcrt1.3.1.o error while running app in device with xcode 8.0 with iOS10

After upgrading xcode to 8.0, my application project build with error for device target but building successfully for simulator.
Error is like:
ld: library not found for -lcrt1.3.1.o
What does the solution for this error.
After spending lots time, i finally got the reason for this error.
Error: ld: library not found for -lcrt1.3.1.o
Solution:
If your project source have deployment target from iOS 5.0 then change it to iOS 6.0 or later and your error will be fix. Now that work fine for device too.
Hurray!!!
crt1.3.1.o is a library that was included in older iOSes (and thus, their SDKs) but is no longer present in newer SDKs.  However, when the project's Deployment Target is set to an older iOS (<6.0, as #Sandy has found), Xcode still tries linking against it.
To keep supporting iOS 5.x in newer Xcodes, one only needs to copy crt1.3.1.o from an older Xcode to the appropriate …/usr/lib/ dir in the newer Xcode.  Xcode will only use crt1.3.1.o if the Deployment Target is <6.0— for projects with a Deployment Target ≥6.0 crt1.3.1.o remains unused and the resulting linked binary is identical to what it was pre-…/usr/lib/crt1.3.1.o-addition.
To get a newer Xcode to properly link a project with a iOS 5.x Deployment Target:
Download an older Xcode that still has crt1.3.1.o from https://developer.apple.com/downloads/.
I used Xcode 5.1.1, though any Xcode that has iOS 5.x support should work (which, according to Wikipedia should be Xcode 4.2-6.4).
Open the Xcode .dmg and on the disk image, locate the file at /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS….sdk/usr/lib/crt1.3.1.o.
Since I used Xcode 5.1.1, mine was at …/iPhoneOS7.1.sdk/usr/lib/crt1.3.1.o.
Copy to the same Xcode.app-relative directory in your newer Xcode: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/crt1.3.1.o.
My newer-Xcode at time of writing is the latest release, Xcode 8.1 (which out-of-the-box includes the iOS 10.1 SDK and downloadable iOS Simulator support back to iOS 8.1).
Note that you'll need to re-perform these steps after each Xcode upgrade, since the standard Xcode update process is to just blow away Xcode.app and everything contained within with the updated Xcode.app.
Also note that I've successfully tested this using Xcode 8.1 to produce an app with a Deployment Target of iOS 5.0 that'll run on both my iOS 10.1.1 iPad Air 2 & my iOS 6.1.3 iPhone 4S.  I have not, however, submitted a build using this process to the iOS App Store.  While it's unlikely that Apple's certification would have a problem with this (since it is after all their own iOS crt1.3.1.o library; and since there is no other way to build an app against the latest SDK while still supporting iOS back to 5.x, which is almost certainly something that some enterprise clients are still doing), I can't make a firm promise here.
remove the -lPods-(someCocoaPod) lines in the 'Other Linker Flags' list BUT only if $(inherited) is at the top. At first I was unsure, but the reassuring sign was that I still saw references to my cocoapods when I left the edit mode(inherited). I tested in debug and release, both of which were giving me errors, and the problem was immediately resolved
Instead of using the libraries from an older Xcode install, you can also just recompile them from sources: https://github.com/mringwal/csu-ios

dyld: Library not loaded different behavior for 6.0 simulator/6.0 device

My app runs fine on the iPhone 6.0 Simulator in Xcode, but when I try to run it on my 6.0 device, I get the following fatal error:
dyld: Library not loaded: /System/Library/Frameworks/AdSupport.framework/AdSupport
Referenced from: /var/mobile/Applications/26329A7C-04B0-415A-B8EB-3C59CC1EC0B1/hammerhead.app/hammerhead
Reason: image not found
I am sure that my Phone has version 6.0 and is up to date. My deployment target is set to 6.0 in my project file and in my info.plist file. What should I do?
The problem seems to be with the AdSupport framework, which I put in my app so the new Facebook SDK (3.1) could function with iOS 6.
If you're targeting iOS versions less than 6.0, you'll need to make AdSupport.framework, Social.framework, and Accounts.framework optionally-linked.
Please have a look at the attached screenshot.
Cheers!!!
Solved my own problem: Set the frameworks that are giving you problems to "Optional" instead of "Required" by going to the project file Summary and scrolling down to Linked Frameworks and Libraries.
Same for CloudKit.framework on iOS 7 (it is for iOS8 only). Go to General > Linked Frameworks and Libraries, change CloudKit.framework to Optional.
Thanks VSN.

Xcode 4 to Xcode 3.2 Compatability

I have an app written that compiles and runs fine in Xcode 4.2. I want to port it into Xcode 3.2 (I have the compatibility option check marked) but Xcode 3.2 gives me an error for some reason. Does anyone know what the issue with this could be?
Additional info:
Base SDK: iOS 4.3
The code in question:
[[self navigationController] pushViewController:adminViewController animated:YES];
Xcode 4:
Xcode 3.2:
Error:
! Expected expression before "adminViewController"
The Xcode project compatibility flags in Xcode 4 are quite redundant. The flag sets the underlying project format and doesn't handle support for the versions of the iOS SDK you're programming for and the versions of the Objective C language and runtime.
If you can open the project in Xcode 3 (as it looks like you can) then it's 'compatible' as far as Xcode is concerned. If you're seeing compiler errors then your issue is to do with running your code older/different versions of the iOS SDK / LLVM / GCC.

Building a universal app for iOS 3.1, iOS 3.2 using iOS SDK 4.2

I have a universal app which was originally built for iOS4.2. Since this project does not use many 4.0+ specific APIs, I would like to build this app with deployment target set to 3.1.
It gets built with no problems.
But when I install and start the app on the iPhone 3.1.3 simulator, I get the following dyld error:
Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_UIActionSheet
iPad specific part of my code is already employs checks to make sure that it doesn't reference any unavailable symbols using:
Class cls = NSClassFromString(#"UIPopoverController");
if (cls != nil) {
_popOverController = [[cls alloc] initWithContentViewController:_settingsController];
}
Any ideas?

Resources