Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I have 2 hard drives in my Mac. One runs 10.7 for my daily work editing videos and such and I won't upgrade that drive, I needs it to stay 10.7. The other drive runs 10.10 which I just use for programming / Xcode so everything is up to date.

I added AVFoundation framework to an app to export .mp4 videos and it works great on 10.10, but not 10.7 where I want to use it.

After scanning my code everything is 10.7 compliant except for this method which was introduced in 10.9
[AVAssetWriter finishWritingWithCompletionHandler:^]

it replaced this code that was depreciated as of 10.9
[AVAssetWriter finishWriting]

I tried to add the finishedWriting method but it is no longer a method that exists and I get a red error which is expected. Can this be fixed so I can use it on 10.7? Is there a way to bring in an older AVFoundation framework to solve this issue?

Thanks
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
Have you set a deployment target of 10.7? At most I'd expect a possible warning that the instance method is deprecated.
Yes, I have always had it set to 10.7 since that is what I use my apps in mostly. It gives me no notification that it will not work on 10.7. There are no errors besides the new one that gives me an error trying to use the depreciated finishedWriting method.
 

Attachments

  • Screen Shot 2015-08-26 at 7.51.14 PM.png
    Screen Shot 2015-08-26 at 7.51.14 PM.png
    13.6 KB · Views: 151

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
Have you set a deployment target of 10.7? At most I'd expect a possible warning that the instance method is deprecated.
EDIT: Upon further inspection this method is part of the AVAsetWriterInput and not the AVAsetwriter. Problem solved and it works. I was trying to use a method that didn't belong to that Class. When I read my code back line by line I caught the mistake. But importing an older SDK work just fine. Below is how I did it.

I opened up an old version of Xcode 4.3 and copied the 10.7 SDK folder. I then opened up the new version of Xcode and pasted it in to the correct location for the SDKs now I have 10.10, 10.9 and 10.7. I restarted Xcode and deleted the AVFoundation framework and added it back in again from the 10.7 SDK folder. Also in Build Settings / architecture I switched the Base SDK from 10.9 to 10.7. but the method finishWriting is still missing?

I must be missing a step or something?
 
Last edited:

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
The finishedWriting method is only available in the AVAssetWriter class, so I'm not sure why you're now talking about AVAsetWriterInput. So, what method and class are you having issues with that you felt importing an old SDK was the right solution? How long ago was the method in question deprecated? Where's your code?
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
The finishedWriting method is only available in the AVAssetWriter class, so I'm not sure why you're now talking about AVAsetWriterInput. So, what method and class are you having issues with that you felt importing an old SDK was the right solution? How long ago was the method in question deprecated? Where's your code?

xStep, I solved the issue. I came to the same conclusion as you did with the AVAsetwriter and AVAsetwriterInput. The method I wanted was located in the AVAsetWrite Class and not the other, but it was still depreciated as of 10.9. What threw me off was when all the frames had been written to the buffer you call this method,
[AVAsetwriterInput markAsFinished];
The next step is to finish it with this method.
[finishWriting];
but that method was depreciated as of 10.9. But even though I got the 10.7 SDKs working right at first, the method wasn't in the class still! The problem was I assumed that if the AVAsetWriterInput was the Class that had the method markAsFinished it would also be the class that would contain the method finishedWriting, I was wrong. AVAsetWriter was the correct class to call for this and it had the finishedWriting method from the 10.7 SDK.

This was the first project using AVFoundations to create still images and convert that to an mp4 video file. very confusing.

Thanks for your help!
 

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
If you figured out you were just using a method in the wrong class type, then you shouldn't have to use an older SDK. I have code that uses finishWriting and although I don't have a 10.7 available to work with, I can tell you I got successful builds and runs on both OS X 10.10 with Xcode 6.4 and OS X 10.11 and Xcode 7 beta 6. I did set the target on both compiles to 10.7.
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
If you figured out you were just using a method in the wrong class type, then you shouldn't have to use an older SDK. I have code that uses finishWriting and although I don't have a 10.7 available to work with, I can tell you I got successful builds and runs on both OS X 10.10 with Xcode 6.4 and OS X 10.11 and Xcode 7 beta 6. I did set the target on both compiles to 10.7.

In the 10.9 SDK the finishedWriting method was not on the list of Methods for the AVAsetWrite Class. A snap shot of the Docs introduced in 10.7 and 10.8, gone in 10.9. If that method is no longer available in 10.9 then it would not be a method that I can use, as for as I know. My first problem was I was trying to use the method in the AVAsetWriterInput Class and it never existed there in the first place. So I imported the 10.7 SDK from Xcode 4.3 and was frustrated again because it would not work!!! Then I had the "Douh" moment when I realized it was never in the the AVAsetWriterInput Class, it existed in the AVAsetWriter Class.

You could be correct. Perhaps if I had realized I was using it in the wrong class first and switched to the correct class before I did all the importing of the 10.7 sdk and switching things round, it might have worked. I suppose I could switch back to the 10.9 frame work and see if that method is available.

All these questions I have been asking pertain to the same app I am working on, which is done now.
 

Attachments

  • Screen Shot 2015-08-29 at 7.38.43 PM.png
    Screen Shot 2015-08-29 at 7.38.43 PM.png
    43.9 KB · Views: 137

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
Try the newer SDK. It should work fine for your target of 10.7 and newer. Depecated methods may never disappear and if they do, it will be several OS and SDK iterations.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.