Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 9.0 issues #100

Closed
cybercent opened this issue Sep 20, 2017 · 10 comments
Closed

Xcode 9.0 issues #100

cybercent opened this issue Sep 20, 2017 · 10 comments

Comments

@cybercent
Copy link

Xcode 9.0

I encounter type issues (about 75 of them):

AVMediaType' (aka 'NSString') is not implicitly convertible to 'String!'; did you mean to use 'as' to explicitly convert?

In :

extension AVCaptureDeviceInput {
    
    /// Returns the capture device input for the desired media type and capture session, otherwise nil.
    ///
    /// - Parameters:
    ///   - mediaType: Specified media type. (i.e. AVMediaTypeVideo, AVMediaTypeAudio, etc.)
    ///   - captureSession: Capture session for which to query
    /// - Returns: Desired capture device input for the associated media type, otherwise nil
    public class func deviceInput(withMediaType mediaType: AVMediaType, captureSession: AVCaptureSession) -> AVCaptureDeviceInput? {
        if let inputs = captureSession.inputs as? [AVCaptureDeviceInput] {
            for deviceInput in inputs {
                if deviceInput.device.hasMediaType(mediaType) {
                    return deviceInput
                }
            }
        }
        return nil
    }
    
}
@cybercent
Copy link
Author

NextLevelSession.swift:258:58: Type 'AVMediaType' (aka 'NSString') has no member 'video'
extension NextLevelSession {
    
    /// Prepares a session for recording video.
    ///
    /// - Parameters:
    ///   - settings: AVFoundation video settings dictionary
    ///   - configuration: Video configuration for video output
    ///   - formatDescription: sample buffer format description
    /// - Returns: True when setup completes successfully
    public func setupVideo(withSettings settings: [String : Any]?, configuration: NextLevelVideoConfiguration, formatDescription: CMFormatDescription) -> Bool {
        self._videoInput = AVAssetWriterInput(mediaType: AVMediaType.video, outputSettings: settings, sourceFormatHint: formatDescription)
...

@colinmcardell
Copy link

I'm seeing this issue as well... It seems to be related to what Swift version I was using when compiling NextLevel. When I switch to Swift 4.0 (previously Swift 3.2) it seems to compile correctly.

Build Settings -> Swift Language Version -> Swift 4.0

@bojanstef
Copy link

@colinmcardell this didn't work for me... trying to figure out a solution now

@colinmcardell
Copy link

Interesting.

I'm using Cocoapods to bring NextLevel into my project and I'm pointing to a specific commit like this:
pod 'NextLevel', git: 'https://github.com/NextLevel/NextLevel.git', commit: 'ed8936a4c9f428016f16d120a0806e5c4e32970a'

Some context around the errors that are listed above by @Slash7:

A few questions:

  1. How are you bringing NextLevel into your project?
  2. What version or commit of NextLevel are you pointing to?
  3. It is mentioned in the README "Need Swift 3? Use release 0.6.3." (here). What happens if you point to 0.6.3 (not that using 0.6.3 is the solution but more to find out if Swift 3 compatible NextLevel compiles)?

@bojanstef
Copy link

bojanstef commented Sep 20, 2017

Finally everything works

Answers to @colinmcardell's questions:

  1. In my Podfile I have pod 'NextLevel'
  2. This installed 0.7.2
  3. I previously used 0.6.3 but decided to upgrade today.

I didn't test going back to 0.6.3 but, my solution was the following:

  1. Remove pod 'NextLevel' then run pod install
  2. Remove all references to NextLevel in my MyProject.xcworkspace
  3. Convert to Swift 4 (and fix all warnings in my target)
  4. Add pod 'NextLevel' then run pod install

Oddly enough everything now works. In between most steps I did the "three cleans"

Hotkey Description
⇧⌘K Product > Clean
⌥⇧⌘K Product > Clean Build Folder...
⌘, Xcode > Preferences... > Locations > "then I delete the derived data folder"

@cybercent
Copy link
Author

@colinmcardell thanks, switching to swift 4 in the build settings fixed this issue.

I've re-downloaded Xcode 8 as there is another issue, on Apple's side this time (https://forums.developer.apple.com/thread/86810) which involves using private APIs and I won't be able to submit to the AppStore using Xcode 9.

@piemonte
Copy link
Contributor

piemonte commented Sep 21, 2017

hey @Slash7, NextLevel 0.7.1 fixes the apple issue you mention.

📎 #99

if you want to use swift 3, you can install 0.6.3

@piemonte
Copy link
Contributor

sorry folks, would have chimed in sooner but didn't see this discussion until now.

@cybercent
Copy link
Author

@piemonte thanks, the fix is great but as you're forced to use private APIs like (__availablePreviewPhotoPixelFormatTypes) the app might not pass the review process.

I've moved back to swift 3 and Xcode 8 until Apple releases a fix for Xcode 9.

@piemonte
Copy link
Contributor

ah, cool, sounds good. on the forum post (https://forums.developer.apple.com/thread/86810), Apple updated it and mentioned the SPI as OK but i understand trying to avoid the risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants