0

I'm following this small perhaps outdated tutorial

https://medium.com/@JTEhlert/using-cocoapods-with-watchos-2-723b92eae04f

I'm using Xcode 12.0, Cocoapods 1.8.4 on mac OS 10.15.5

target 'Watch Extension' do
        platform: watchos, '2.0'
        watchPods
end

I get this error:

[!] Invalid `Podfile` file: syntax error, unexpected ':', expecting end
        platform: watchos, '2.0'
                ^
/Users/username/Documents/dir/dir/Podfile:42: syntax error, unexpected '\n', expecting '.' or &. or :: or '['.

 #  from /Users/username/Documents/dir/dir/Podfile:42
 #  -------------------------------------------
 #  target 'Watch Extension' do
 >          platform: watchos, '2.0'
 #          watchPods
 #  -------------------------------------------

I don't think I'm introducing syntax errors but I guess thats what the errors are reporting. I feel like I'm facing a "missing comma" compiler problem.

Other sources like here would suggest my approach syntax is correct but obviously I'm doing something else wrong

https://github.com/neonichu/native-watchOS-example

Sean Dev
  • 1,239
  • 1
  • 17
  • 31

2 Answers2

0

It looks like you're following the podspec (library provider) instructions instead of the Podfile (library consumer) instructions.

Paul Beusterien
  • 27,542
  • 6
  • 83
  • 139
0

I think there was actually two errors in the posted code.

One is that it's not "Watch Extension" just "Watch".

The other is the semicolon should be attached to the "watchos" not the "platform" -- as observed from the working example meaning original author never passed his code through a compiler. In Swift this syntax is valid but not Ruby which is why it escaped my attention.

Sean Dev
  • 1,239
  • 1
  • 17
  • 31