Reputation: 60869
To support OS 3.x, please set Base SDK to iPhone Device 4.0 and iPhone OS Deployment Target to iPhone OS 3.x. Extra linker flags may be needed if NSConcreteGlobalBlock and UIBackgroundTaskInvalid runtime error occur under 3.x.
The linker flags are:
-weak_framework UIKit
-weak_library /usr/lib/libSystem.B.dylib
EDIT: im still getting the same build error, even after linking: cl.ly/c69ca3f8a336d7e41256
Upvotes: 2
Views: 3766
Reputation: 123
You've probably already done this, but did you switch iOS Deployment Target to 3.2 and Base SDK to 4.x in the build settings? If you've set both of those and added the linker flags, then I can't explain why you would be getting a build error.
Upvotes: 1
Reputation: 12081
Not sure what causes the build problems. But both NSConcreteGlobalBlock and UIBackgroundTaskInvalid make me think you encounter problems in an app that uses background processing and still needs to run on 3.x.
Personally I've never seen these problems, and I've certainly never weak-linked UIKit or libSystem. Even in apps that work perfectly fine on 3.x and support 4.0 features like blocks and background audio I have not needed the suggested fixes.
The general rule to accomplish this: do not use blocks in code that might be executed on 3.x. So only start backgrounding in - (void)applicationDidEnterBackground:(UIApplication *)application. This delegate method doesn't exist in the 3.x protocol and will therefore not be called. If you would use blocks in methods that are called on 3.x it will cause a crash.
Upvotes: 1
Reputation: 9593
Double-click on your target or application in Xcode to open the Info window
Switch to the "Build" tab
Add "-weak_framework UIKit -weak_library /usr/lib/libSystem.B.dylib" to "Other Linker Flags" (under "Linking")
Upvotes: 2