007 ofxiPhone not compatible with 3.x devices?

I’m trying to figure out why 007 won’t fun on 3.x targeted devices.

First, CoreVideo, CoreMedia, and AVFoundation need to be weak linked since they’re iOS 4.0 only. After that though, I get the error

dyld: Symbol not found: __NSConcreteStackBlock  
  Referenced from: /var/mobile/Applications/B72917E7-E881-4EA4-9E16-71062A128438/BG-iPhone.app/BG-iPhone  
  Expected in: /usr/lib/libSystem.B.dylib  

From searching, BLOCKS are iOS 4 only too, but I’m not sure how to weak-link this or where to find them in the code to ifdef them for iOS 3.x. From what I understand, you’re supposed to be able to add:

-weak_library /usr/lib/libSystem.B.dylib  

under “Other Linker Flags” , but that doesn’t seem to help.

Ok after further exploring, I believe these are the steps to get things running on 3.x devices.

  1. In Xcode, Click on target -> application name
  2. In the File Name window, set AVFoundation, CoreMedia, and CoreVideo from role “required” to “weak”. They need to be weak linked since they’re only available in iOS 4+.
  3. In ofxiPhone src folder, AVFoundationVideoPlayer.mm uses CMBlockBufferRef and that is only available in iOS4. This means, this function should be commented out (sorry - avfoundationvideoplayer won’t run on iOS4). Either that or you can comment ouf AVFoundationVideoPlayer from being included in OF.
  4. Clean all targets and rebuild

There’s probably a better way to handle #3, but I’m not using AVFoundationVideoPlayer so I haven’t looked into it yet.

I don’t *think* AVFoundation is iOS4+, just some of the functionality.

I hope, anyway. Anyone know how to downgrade a 2nd-gen iPod Touch?

The AVFoundation has to be weak linked still. Sorry, I don’t know how to downgrade. =\

Okay, luckily enough my iPod Touch is the right model for a proper downgrade so I managed to get it running 3.1.3 again. Should be handy for testing. Apple really need to make this easier to do - perhaps limit it to dev accounts or something, because as it is I shouldn’t have to trawl shady sites for a bunch of different files AND have to use a Windows machine to get it done.

Anyway my current project isn’t using 007 so I can’t outright disclaim the need to weak link AVFoundation if you’re using 007, but the sound engine I use (ObjectAL) uses AVFoundation and it runs just fine on 3.1.3. That was my major concern.

Btw it seems the terminology is different in Xcode 4 - it’s Required/Optional

Yeah, I’m only going off what the errors are trying to run on a 3.1.x device. It required me to weak link the AVFoundation framework. These issues only seem to come up in 007.

I’m now using Xcode 4.2, iOS5.0 SDK, and the “official” 007 iPhone download, and I can’t get past this:

dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4

This is… unfortunate.

Okay, my fix here is to comment out




and set CoreVideo, CoreMedia, and AVFoundation to optional linkage.

Oh yeah, you also have to add the armv6 architecture when building for the older devices. Dunno if that’s an iOS5 SDK thing or Xcode 4.2 thing.

Cool thanks SiW. That should be useful.

Now that iOS 5 is out, I’ve pretty much decided in my future apps to make the minimum iOS4 to avoid most of the headaches. Currently less than 1% of users have iOS 3.x in my experience.

Same here - 4.x and 3rd-gen or higher in the future. But I didn’t want to get into a situation where I couldn’t build updates for my existing apps for the old devices, and have to say “HEY GUYS DON’T UPDATE IF YOU HAVE AN OLD PHONE!!!”

Yeah, I agree.

Are there any stats out there showing which iOS versions the world is running, and also what devices people have.

I think I’m going to do iOS 4 minimum. I’ve considered iPhone 4 and up only, but am aware many people have 3gs. I don’t know if the older 3 is still in use.

I really should have analytics in my apps so I know what my users are actually running, but I’m dumb like that :smiley:

Anecdotal evidence does make it seem like the 2nd-gen hardware (3G, iPod Touch 2nd-gen and lower) is very minority though. 3GS has a pretty large install base though, and I think it’s going to be significant now they are free-with-contract in the US. In practice you can expect roughly equal-if-not-better performance between the 3GS and the 4 though, half the resolution really lets the 3GS keep pace.

What I really should find out is the split between iPad 1 and 2, because that’s a pretty major performance difference, not to mention the memory issue.

Previously, I was supporting iOS 3.x before because I only had a first gen iphone to test on. However, the 3g and up can all run iOS 4 and now 3gs can run iOS 5.0.

I haven’t checked any public analytics, but from my own app analytics which has over 100,000 users, there’s less than 1% on 3.x. For iPad, everyone is at least on iOS 4.

So I think it’s pretty safe to start any new apps (or even updates) with iOS 4 since even if a user originally was on 3.x, they’re most have upgraded to at least iOS 4. Only the first gen phone is unable to run the newer OS and it’s very rare to find someone with a first gen iPhone (although I was one of them hah).

I think supporting the last two major versions (iOS 4/5) is a good rule of thumb. A lot of the APIs for various sites are starting to integrate things that only iOS 4 and above supports - so supporting 3.x is becoming a problem. I think it’s reached the point of diminishing returns considering how many people are still running that OS.

This article http://www.readwriteweb.com/mobile/2011/01/what-percentage-of-iphone-owners-are-on-ios4.php from January gives an idea of 90% are on iOS4. I would say since it’s been 10 months since then, that 95%+ would seem accurate (especially since my analytics say ~99%).

BTW, SiW, if you need any analytics you should try out http://www.flurry.com/. There’s an OF addon on github, but you really don’t need it because it’s 1 line of code to initialize and 1 line of code every time you want to track something.


Well I’m still in the 90’s and got a 3.1.3 3G iPhone here… and am kind. of. close. to getting oF running in the poor guy. I weak-linked lSystem with the -weak-lSystem flag and commented the c++ config mentioned. The error I am getting is:

dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4  
  Referenced from: /var/mobile/Applications/9DB37290-7E75-44D8-81AD-8B71882BF944/Maraca.app/Maraca  
  Expected in: /usr/lib/libSystem.B.dylib  
dyld: Symbol not found: ___sync_fetch_and_add_4  
  Referenced from: /var/mobile/Applications/9DB37290-7E75-44D8-81AD-8B71882BF944/Maraca.app/Maraca  
  Expected in: /usr/lib/libSystem.B.dylib  

I can’t upgrade my 3G to anything above 3.1.3 because it will become too slow and it is jailbroken so I can use it in the US (in T-Mobile). Can’t get a new one.

I just want the Touch/Accelerometer example working in the thing.

Thanks for any help!

By the way, if I use XCode 4 I get Apple Mach-O linker errors in the form:

Undefined symbols for architecture armv6:  
  "__ZN8ofColor_IhE6setHexEif", referenced from:  

In the Touch/Accel example

You have to also weak link libSystem.B.dylib. I can’t remember how I did this. I think I had to first add it as a library since it wasn’t listed.