Symbol not found: _objc_retainAutoreleasedReturnValue - ios

I was previously able to run my code on an iOS 4.3 device but now I'm getting this error at runtime:
Symbol not found: _objc_retainAutoreleasedReturnValue
The project is using a base sdk of 6.0 and deployment target of 4.0.
Maybe not a coincidence, but this is the first time I've tried to run on this device since upgrading to XCode 4.5.
I've looked in stackoverflow at previous questions containing _objc_retainAutoreleasedReturnValue but they seem to mention #autoreleasepool, which I'm not using explicitly anywhere.

Check that libraries you include are built with the same deployment target requirements as your main project.

The deployment target of your App target should match the deployment target of your project file.

Related

dyld: Library not loaded: #rpath/libswiftCore.dylib after Xcode Update

I am having problems with an app I've been working on for a while. Everything was fine until went mad and updated Xcode to 9.4 (previously 9.3).
I'm using a third party framework compiled on swift 4.0.3. I worked perfectly, but after the update it wouldn't compile (can't build the framework compiled on 4.0.3 with 4.1). I downloaded and installed the Swift 4.0.3 Release Toolchain and i'm able to build with no errors.
However, when I run the target on the device (iOS 9.0 ipad) it crashes with dyld`dyld_fatal_error:
dyld`dyld_fatal_error:
0x1fe9008c <+0>: trap
0x1fe90090 <+4>: nop
The console outputs this:
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /private/var/containers/Bundle/Application/2E966F50-67E3-4250-858C-382319CD6274/myApp.app/Frameworks/myFramework.framework/myFramework Reason: Incompatible library version: myFramework requires version
1.0.0 or later, but libswiftCore.dylib provides version 0.0.0
Some Facts:
The Framework is in Embedded Binaries and Linked Frameworks and Libraries under General and Link Binaries with Libraries and Embed Frameworks under Build Phases.
This app need's to deploy on iOS 9.0 and the Deployment target is set accordingly.
I installed Xcode 9.3 again, but I had the same problem using the 4.0.3 toolchain.
My suspicions:
Can the Toolchain be corrupted in some way? I installed Swift 4.0.3 Release 2017-12-05 (a)
Even though I am working with the 4.0 toolchain, I can only choose from 4.1 and 3.3 under Swift Compiler in Build Settings. I imagine this is overwritten, but not sure.
My main concern is that even though the deployment target is set to iOS 9.0, under the BASE SDK is set to 11.3, and can't choose another. I can't find the 9.0 SDK on the internet. Could this be the problem?
Also, all of my certificates are valid and ok.
Thanks in advance, I'll add edits every time I find something new.
Well, I didn't receive any help here, but just in case anyone needs to know, the only way I managed to solve this was asking for an updated version of the framework we are using. It appears this is a compatibility problem that has no solution.
Following #Danf instructions solved for me.

error: Invalid bitcode version (Producer: '800.0.35.0_0' Reader: '703.0.31_0')

When I try to Archive my application on Xcode 7.3.1, I am getting following error:
error: Invalid bitcode version (Producer: '800.0.35.0_0' Reader:
'703.0.31_0') clang: error: linker command failed with exit code 1
(use -v to see invocation)
I was able to successfully Archive my app yesterday, can any one please help me?
i had this error before ...
you may try the following solution it worked for me
search for bitcode keyword in app --> Build Settings and change it to NO
then archive again -->
it should work fine now
Install Xcode 8:
https://developer.apple.com/download/
Xcode 8 GM seed may be used to submit apps to the App Store.
More info:
In my case I updated to the latest Facebook iOS SDK 4.15.1. Since that library was updated with Xcode 8 and I was still using Xcode 7.3.1 it caused the error.
https://developers.facebook.com/docs/ios/change-log-4.x
Updated for Xcode 8 GM and iOS 10.
So, double check 3rd party libraries.
Or if you don't mind disabling bitcode:
Go to build settings search bitcode and change "Enable Bitcode" to "No".
I also faced the same problem, and as suggested by #Nate,
the issue was because of a third party SDK integrated in our project using Cocoapods.
To help me figure out which one of the 15 pods i had in the project was responsible, i did the following:
Create a new xcode project
Copy the Podfile from your original project to the newly created project's directory
Do pod install
Remove one or more of the pods⋆
Archive the new project, and see if it succeeds, if not repeat step 4 till you are able to archive
⋆(you can also try something like binary search, wherein you delete the first half pods in your Podfile and see if the new project archives)
Once you've figured out the library causing the issue, keep downgrading the library by explicitly specifying the version in Podfile, until the project archives successfully.
And then you can use that version of the library to archive and upload to the app store.
If you are using lib or pod that mean that one of them built by a higher version of your current Xcode, you can either update your code or return back to the previous version where the pods were built by your current version.
If you ran pod update check the pods updated if you ran pod install check the dates of the pods comparing to the release date of your Xcode that will will lead you to the responsible pod.
I got it while I was building using Xcode 8.2.1 and the pod built by Xcode 8.3.1
I also faced this error: Invalid bitcode version (Producer: '800.0.24.1_0' Reader: '703.0.31_0') I have googling so many but unable to find the proper solution. I tried Myself and solved this probable
In my case this error occurs after adding FBSDK by drag and drop that we all usually do.
You can resolve this problem by following these steps:
Delete all pod script in build Phases.
Delete the dragged FBSdks file from the project.
Exit xcode and delete 3 things "Pod folder","Podfile.lock" and "Projectworkspace"
Search and add FBSDK pod link in podfile
Install the pod again by using terminal.... now open Xcode archive your project build.
good solutions, but disabling bitcode worked for some people.
edit :- it worked for me too.
but in future your app might be in problem or (build not optimised by Appstore) if your project is **Bitcode Disable **.
Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.
Note: For iOS apps, bitcode is the default, but optional. If you
provide bitcode, all apps and frameworks in the app bundle need to
include bitcode. For watchOS apps, bitcode is required
So thats why try to figure out error solutions right way.
The error basically says:
The static linker could not correctly link a certain bitcode bundle, which was
produced using Producer: '902.0.39.2', and is being read using Reader:
'900.0.37'.
You can look up at https://gist.github.com/yamaya/2924292 to identify the Xcode versions for the corresponding compiler versions. In the current case, the reader (our Xcode version) is Xcode 9.0, whereas the producer (Xcode version of typically a third party SDK) is Xcode 9.4. The incompatibility between the two is the root cause of this issue.
You may either:
turn off the bitcode as discussed in other answers, or
roll-back the SDK to a previous version that worked well, or
update your codebase to use the newer Xcode version.

dyld: Symbol not found on iOS8/xcode7 [duplicate]

For the first time I was able to compile my app in Xcode 7 (failed in beta 4 and 5). So, thats good progress I guess.
However, when i load my app on my iPhone 6, iOS 8.4.1, it crashed in the debugger with the following message:
dyld: Symbol not found: _NSArray0
Referenced from: /private/var/mobile/Containers/Bundle/Application/0294DF62-AE80-485D-BB11-8C3A5D39777D/Boxtiq.app/Boxtiq
Expected in: /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /private/var/mobile/Containers/Bundle/Application/0294DF62-AE80-485D-BB11-8C3A5D39777D/Boxtiq.app/Boxtiq
Is this something to do with the order of the libraries being linked? Look forward to some advise.
Thanks!
I fixed it by putting this in the podfile. platform :ios, '8.4'
No need to update your device to iOS 9 and lose out on 8.4 testing.
I had the same error and I fixed.
I removed CoreFoundation.framework and Add again with Status "Optional" and works.
If anybody else got this while running unit tests do the following:
Select unit tests target
Go to Build Settings
Search for 'Deployment Target'
Change Deployment Target version to your project's deployment target
That's it!
I also had this problem and I fixed it by adding framework CoreFoundation.framework to Build Settings.
This as a problem on iOS8 build with the new XCODE release, Please remove CoreFoundation.framework and Add it again with Status of "Optional".
I used to have the same error during compilation of a mac os project after updating the Xcode for 7.0 GM version (7A218). Xcode 7 has the 10.11 sdk in it only (you could check that in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs, where it's a MacOSX10.11.sdk).
At compilation time the xcode will link the frameworks from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks, but at runtime from /System/Library/Frameworks/ as I guess.
I have OS X 10.10.5 (14F27) on mac. Either I have my static library that I've built by xcode 7 (MacOSX10.11.sdk as you remember from earlier), which I've linked to my project after. After running I got the runtime error as
dyld: Symbol not found: _NSArray0
I think it's because the library has been compiled with CoreFoundation.framework from mac os sdk 10.11, but at runtime was linked to CoreFoundation.framework from /System/Library/Frameworks/ where version of which is 10.10 (as OS version).
How I fixed this. Friend of mine has xcode 6 yet, I took mac os sdk 10.10 from there (as you remember in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs, name is MacOSX10.10.sdk) and added it to Xcode of mine. Then I rebuilt my static library with 10.10 sdk (you could compile from cli with '-sdk macosx10.10' parameter or set build sdk in Build Settings => Base SDK). After the problem has been solved.
I assume that for the iOS you could apply the same strategy.
I experienced the same exact crash running Xcode 7.0 beta 6 on a device with the first iOS 9 beta installed, the crash however was not occurring while using the simulator.
After updating my iPhone to iOS 9 beta 5, the crash stopped.

Missing SDK in target - iphoneos5.0

I'm using Xcode 4.4.1. I'm getting this warning:
Missing SDK in target MyApp iphoneos5.0
I want to target iOS 5.0 and up. Where should I look to fix this?
In Target, Build Settings, Base SDK is set to iphoneos5.0.
EDIT: Furthermore, if I set the base SDK to latest iOS (5.1), does that mean that users running 5.0 will not be able to install the app?
It means your build settings are incorrect. You set the string to "iphoneos5.0" which doesn't exist anymore. You will now be compiling against "iphoneos5.1". Instead you should simply choose "Latest iOS" (= "iphoneos") To have the compiler select automatically.
Users will still be able to run your app on any version above your app's target version (assuming you didn't use any libraries that don't run on those lower versions).

Deploying for iOS3.1.3 using Xcode 4.2

Just upgraded to Xcode 4.2 and am trying to figure out how to compile an app for iOS3.
I've set the deployment target as iOS3 but am getting this build error:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I assume this is a library that has been added but not sure where to find this option in Xcode nor how I solve it.
Any suggestions?
You are getting compile error because the compiler cannot find your library but not because it cannot compile for iOS 3.
You are doing right at the deployment target part.
Try use libz.dylib instead of the one with version fixed in its filename, see if it resolved the compile error.
It's not possible. Apple removed support for arm6 processors (= <= iOS 3) in Xcode 4.2.

Resources