0

I've just downloaded the Incognito starter project and after I opened it, I converted it to the latest Swift syntax as the option was there. After that I got an error of linker command failed with exit code 1 (use -v to see invocation) which I tried to fix using the advices from here. It helped me to fix the error. Then there were two other errors like this:

value of optional type 'NSData?' not unwrapped, did you mean to use '!' or '?'

and this:

value of optional type 'CGContext?' not unwrapped, did you mean to use '!' or '?'

For this function:

  func snapshot() -> NSData {
    UIGraphicsBeginImageContext(self.view.frame.size)
    self.view.layer.renderInContext(UIGraphicsGetCurrentContext())
    let fullScreenshot = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil)
    return UIImageJPEGRepresentation(fullScreenshot, 0.5)
  }

After listening to the constructor and fixing it, it turned out to be:

  func snapshot() -> NSData {
    UIGraphicsBeginImageContext(self.view.frame.size)
    self.view.layer.renderInContext(UIGraphicsGetCurrentContext()!)
    let fullScreenshot = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil)
    return UIImageJPEGRepresentation(fullScreenshot, 0.5)!
  }

But now I get the same error as in the beginning:

linker command failed with exit code 1 (use -v to see invocation)

Any help would be really appreciated!

Community
  • 1
  • 1
Walker
  • 39
  • 5
  • Click the linker error in the issue navigator to get more details about it, and post them. The problems are probably unrelated. – Andreas Feb 07 '16 at 18:26
  • You're right it has nothing related to this. It gives a warning: directory not found for option '-F/Users/user1/Library/Developer/Xcode/DerivedData/Incognito-bkpdxbihpouieqfokxbfztfezxot/Build/Products/Debug-iphonesimulator/Pods' And: 'framework not found Pods'. But I'm still a bit confused, what should I do with the pods? – Walker Feb 07 '16 at 18:59
  • A good guideline is to start fresh with google, and if that doesn't help, ask another question for this problem. If it's a cocoapods project, you should make sure to never use the project file. Only use the workspace file. – Andreas Feb 07 '16 at 19:06
  • Thanks, it worked now. :) – Walker Feb 07 '16 at 21:35

0 Answers0