Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}' - ios

I am trying to install a pod in project. But i am getting this error:
Invalid 'Podfile' file syntax error, unexpected $undefined, expecting
'}'.
Podfile contains:
platform :ios, '7.0' pod 'RestKit', '0.21.0'
The terminal shows following message:
[!] Invalid `Podfile` file: compile error
/Users/work/Desktop/tg/RESTKitDemo/Podfile:1: syntax error, unexpected $undefined, expecting '}'
{\rtf1\ansi\ansicpg1252\cocoartf1265
^. Updating CocoaPods might fix the issue.
# from /Users/work/Desktop/tg/RESTKitDemo/Podfile:1
# -------------------------------------------
> {\rtf1\ansi\ansicpg1252\cocoartf1265
# {\fonttbl\f0\fmodern\fcharset0 Courier;}
# -------------------------------------------
Can i know what is the problem with my podfile?

I got error
Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
pod 'MBProgressHUD'
becasue I was declaring Pod files like
pod 'SlideMenuControllerSwift',
pod 'MBProgressHUD'
pod 'SDWebImage'
there is one "," (colon mark) in above podfile name pod 'SlideMenuControllerSwift',. I just removed the colon mark.
It worked.
correct way:
pod 'SlideMenuControllerSwift'
pod 'MBProgressHUD'
pod 'SDWebImage'

Assuming you correctly copied your Podfile over there needs to be a newline between those two lines.
platform :ios, '7.0'
pod 'RestKit', '0.21.0'
Also as of a relatively new version of CocoaPods you actually don't need that first line, the command line tool will determine the correct OS based off of your project's settings.
Edit:
From the new output you posted it looks like your Podfile isn't actually a plain text file. You should recreate it in an editor like Sublime Text and make sure it saves as a plain text file.

I was faced same problem when, I changed my MAC.
1- Make setup - Pod setup or update
So I created a new test project --
And open terminal
Run these command
cd /path your project
pod init
// add any pod in your pod file
pod install
and then you can update pod in your old project .

No special characters or any thing else is allowed in pod file, except the name of pod which we are integrating, unknowingly if we enter any characters such as , \ etc. it may result in the following error.

I just ran into this issue because I was doing:
pod 'Fireworks', :path '/Users/honey/Documents/mypod-ios'
The fix was to just add: =>
pod 'Fireworks', :path => '/Users/honey/Documents/mypod-ios'

Related

iOS - Add Swift pod to Objective-C project

Hello I'm working on an old Objective-C project, that has 30+ pods dependecies, all written in Objective-C.
I'm trying to add a Swift pod, this one in particular :
pod 'CSV.swift', '~> 2.4.3'
# ...
# other Objective-C pods ...
# ...
Because I would like to continue new developments in Swift.
But I cannot make it work. If I add use_frameworks!, I get an error at pod install :
The 'Pods-myProject' target has transitive dependencies that include static binaries: (/myProjectPath/Pods/ObjcPod/ObjcPod.framework)
And if I remove use_frameworks!, I get tons of compilation errors, here are some :
Undefined symbol: protocol descriptor for Swift.UnicodeCodec
Undefined symbol: dispatch thunk of Swift.UnicodeCodec.decode<A where A1: Swift.IteratorProtocol, A.CodeUnit == A1.Element>(inout A1) -> Swift.UnicodeDecodingResult
I don't know what I could try otherwise, any help would be much appreciated !
This way you can use swift pod in objective c project try this solution.
Write in your pod file
target 'YourProjectName' do
use_frameworks!
pod 'CSV.swift', '~> 2.4.3'
// Here you can add mode pod as per your requirement Like
pod 'Firebase/Core'
pod 'Fabric'
pod 'Crashlytics'
end
Then Run Pod Install.
For import write this
#import CSV;
And then you have access of your CSV pod files.

pod install causes error "unknown file type" when creating Acknowledgements.plist

I'm using CocoaPods for my app.
One of the modules is written in Swift, so my Podfile is as below.
platform :ios, "8.0"
use_frameworks!
target "ossTest" do
pod 'Charts', "~> 2.0"
pod "Color-Picker-for-iOS", "~> 2.0"
end
post_install do | installer |
require 'fileutils'
FileUtils.cp_r('Pods/Target Support Files/Pods/Pods-Acknowledgements.plist', 'ossTest/Settings.bundle/Acknowledgements.plist', :remove_destination => true)
# error
#FileUtils.cp_r('Pods/Pods-acknowledgements.plist', 'ossTest/Settings.bundle/Acknowledgements.plist', :remove_destination => true)
end
When I run pod install, an error message appears:
[!] An error occurred while processing the post-install hook of the Podfile.
unknown file type: Pods/Target Support Files/Pods/Pods-Acknowledgements.plist
Of course, I've prepared Setting.bundle and inside the bundle, I've created an empty Acknowledgement.plist, and modified root.plist to the suggested setting.
My CocoaPods' version is 0.39.0.
How can I solve the error?
In my case, I was just running pod install in the wrong directory. Obviously, because file paths in your Podfile are relative, it means you should run the script from your project's root directory.
Turns out the issue is not with CocoaPods. Instead it can't find a file at the provided location... Go in finder and insure there is a file at "Pods/Target Support Files/Pods/Pods-Acknowledgements.plist"

CocoaPods with Realm

I am trying to use CocoaPods to install Realm. I have done it before with no problem but now I am getting an error. Below I posted my Podfile code and the error I am getting back in Terminal
Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
Uncomment this line if you're using Swift
use_frameworks!
target 'Htlaeh' do
pod 'RealmSwift'
end
target 'HtlaehTests' do
'pod RealmSwift'
end
target 'HtlaehUITests' do
pod 'RealmSwift'
end
Error
[!] Invalid `Podfile` file: syntax error, unexpected tCONSTANT, expecting end-of-input
target 'Htlaeh' do
^. Updating CocoaPods might fix the issue.
# from /Users/Cody/Desktop/Htlaeh/Podfile:7
# -------------------------------------------
#
> target 'Htlaeh' do
#
# -------------------------------------------
I think I can see two potential syntax errors in there that CocoaPods wouldn't be happy about:
Uncomment this line if you're using Swift needs to be commented out (It was referring to the line below it. ;) )
In the Tests target, it should be pod 'RealmSwift'. The apostrophe is in front of 'pod' right now.
Please try correcting those two syntax issues, and if that doesn't fix it, let me know. :)

Importing a library with cocoapods

I am trying to use this library in my ios project:https://github.com/nuclearace/Socket.IO-Client-Swift
I am trying to use with cocoapods.I created a Podfile in my project library.
This is my podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Socket.IO-Client-Swift', '~> 2.2.2’
When I run, I am getting following errors:
SyntaxError - /Users/.../Documents/SwiftSonSurum/Podfile:4: unterminated string meets end of file
[!] Oh no, an error occurred.
It appears to have originated from your Podfile at line 4.
How can I fixt these errors ?
The last quote of your podfile should be a ' instead of a ’

pod repo lint error: [!] An unexpected version directory `<a dir>` was encountered for the `<Parent Dir>` Pod in the `<Parent Dir>` repository

I am tryin to lint my pod spec and getting the following error.
[!] An unexpected version directory 'ios' was encountered for the 'Classes' Pod in the 'Classes' repository.
My source folders are set as follows:
Classes
- ios
- osx
Podspec has source files as:
s.source_files = 'Classes/**/*.*'
Any ideas what is causing this error?
OK I was having a bad day. Should have been using:
pod spec lint .

Resources