Syntax error in Cocoapods podfile - xcode

When I run the "pod install" command in the Terminal, I get this error message:
[!] Invalid `Podfile` file: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('.
# from /Users/pdenlinger/Desktop/Clima-master/Podfile:1
# -------------------------------------------
> Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
# -------------------------------------------
Here are the contents of the podfile, which I edited with Xcode:
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Clima' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Clima
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'SVProgressHUD'
end

Comment the first line:
#Uncomment the next line to define a global platform for your project
Not a great error message ...

Related

dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit - macCatalyst

Run fails with the error for mac Catalyst
require 'cocoapods-catalyst-support'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
pod 'SwiftyStoreKit'
end
# Configure your macCatalyst dependencies
catalyst_configuration do
# Uncomment the next line for a verbose output
verbose!
# ios '<pod_name>' # This dependency will only be available for iOS
# macos '<pod_name>' # This dependency will only be available for macOS
end
post_install do |installer|
installer.configure_catalyst
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'Yes'
end
end
end
end
This is my podfile ,ya this contains more pods other. than SwiftyStoreKit.
i am able to run without the SwiftyStoreKit, but if i add at then getting this error and breakpoint
dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit
Referenced from: /Users/admin/Library/Caches/...../Build/Products/Debug-maccatalyst/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
i am using this tool to exclude pods for mac catalyst: https://github.com/fermoya/cocoapods-catalyst-support
using
Xcode : 12.4
macOS : Big Sur 11.2.2
Integrating SwiftStoreKit with Swift Package Manager solves the issue.
If you are using Xcode 11 or later:
Click File
Swift Packages
Add Package Dependency...
Specify the git URL for SwiftyStoreKit.
https://github.com/bizz84/SwiftyStoreKit.git

Getting 401 Unauthorized error when installing a pod

I'm setting up a new pod in my pod file and when I do pod install I have an error what should I doing ?
I tried this line to add the pod in my podfile :
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token='
this the error
[!] Failed to fetch podspec for MapboxVisionNativeAll at https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=<sk.eyJ1IjoiYnJhaGltY2hlYmJpIiwiYSI6ImNqdXlhMXl6aDBmeXo0M3BpYjV6MnFib3IifQ.VinI6ER1YN2nDxXRJzaFXw>.
Error: 401 Unauthorized
=> I guess, You are misplacing your .netrc.
=> The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).
In terminal type: cd ~
touch .netrc
open .netrc
paste below to .netrc with SecretKey
machine api.mapbox.com
login mapbox
password <INSERT SecretKey>
Enjoy: pod install will work without error
Following is my working Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.2'
use_frameworks!
target 'PROJECT_NAME' do
pod 'MapboxVisionNativeAll', :podspec => 'https://api.mapbox.com/downloads/v1/vision/ios/mapbox-vision-native-all/0.3.0.podspec?access_token=sk.eyJ1IjoiZWRkeXZlcmJydWdnZW4iLCJhIjoiY2p1c3F5eGVpMDA1eTRlbzJpOXJwdDIxMCJ9.OZRITqde9clot1E8Za_OsQ'
end
This error occurs if the token is invalid.
I tried accessing the link from the error and it says that the token is invalid.

cocoapods pod file dependency issue with Firebase, specifically FirebaseUI

I am trying to use the Firebase Storage documented example code :
// Reference to an image file in Firebase Storage
let reference = storageRef.child("images/stars.jpg")
// UIImageView in your ViewController
let imageView: UIImageView = self.imageView
// Placeholder image
let placeholderImage = UIImage(named: "placeholder.jpg")
// Load the image using SDWebImage
imageView.sd_setImage(with: reference, placeholderImage: placeholderImage)
adapted like so in my app:
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(getuid())/thumb_\(picid).jpg");
let placeholderImage = UIImage(named: "placeholder.jpg")
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
}
but the method sd_setImage was not found by xcode so I thought I had to update my podfile with the pod 'FirebaseUI/Storage' but after tinkering with my podfile I get this error:
pod update
Update all pods
Updating local specs repositories
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master fetch origin --progress
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 12), reused 7 (delta 4), pack-reused 0
From https://github.com/CocoaPods/Specs
24df16553de..7cae8225fce master -> origin/master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master reset --hard origin/master
HEAD is now at 7cae8225fce [Add] MixedRealityKit 0.1.6
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `TwitterCore (~> 2.8.0)` required by `Podfile`
- `TwitterCore (>= 3.0.0)` required by `TwitterKit (3.0.0)`
- `FirebaseUI` required by `Podfile`
Specs satisfying the `FirebaseUI` dependency were found, but they required a higher minimum deployment target.
My pods file is like so though I have tried other pod combinations but to the same or worse effect:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
target 'StrengthStandards' do
#Pods for StrengthStandards
pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
What am I doing wrong? Also my xcode gives the error No such module 'FirebaseAuthUI' on my import FirebaseAuthUI line.
Before this problem I had my Firebase Database and Firebase Auth working.
I am using Xcode 8.3.3 and Swift 3, on MacOS 10.12.6
Thanks
PS: making some progress - now my podfile is:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
#Pods for StrengthStandards
#pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
#pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and I no longer get the dependancy issues however, xcode now tells me that the method call
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
is wrong:
/Users/myname/Dev/IOSDev/StrengthStandards/StrengthStandards/Settings.swift:325:40: Cannot convert value of type 'StorageReference' to expected argument type 'URL?'
Seems to work now though I admit I'm not sure if it is exactly the way it is supposed to be done. For anyone interested here is what I have so far:
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
pod 'Firebase/Core'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'Firebase/Database'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
pod 'SDWebImage/Core'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and here is my function:
import SDWebImage
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(Constants.getUID())/thumb_\(picid).jpg");
imagesRefs.downloadURL { url, error in
if let error = error {
// Handle any errors
print("Error getting url for profile pic: \(error)")
} else {
// Get the download URL for 'images/stars.jpg'
let placeholderImage = UIImage(named: "placeholder.jpg")
self.profilePicIV.sd_setImage(with: url, placeholderImage: placeholderImage)
}
}
}

dyld: Library not loaded: #rpath/ ... Reason: image not found with a simple Hello world applicat

I am running into some trouble when trying to use SwiftCSV using CocoaPods and following the basic instructions.
After creating the simple Hello world console application for OS X from the template in XCode 7.3.1, I opened a terminal window and navigated to the project folder and issued a pod init
I then edited Podfile by adding the line below in the target section:
pod "SwiftCSV"
I then executed pod install, which completed successfully.
After loading the resulting .xcworkspace in XCode, when I run the application, I get the following error:
dyld: Library not loaded: #rpath/SwiftCSV.framework/Versions/A/SwiftCSV
Referenced from: /Users/paolomarini/Library/Developer/Xcode/DerivedData/BundleGeneratorSwift-egsxgxpdiuvqrfddzyzcxnwltulk/Build/Products/Debug/BundleGeneratorSwift
Reason: image not found
Program ended with exit code: 9
Note that I didn't specify a platform in Podfile as I can't figure out what the correct value is for OS X. The Podfile is as below:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'BundleGeneratorSwift' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BundleGeneratorSwift
pod "SwiftCSV"
end
Thanks,
Paolo

SQLite.swift unknown type name 'NS_ASSUME_NONNULL_BEGIN'

I'm using SQLite.swift. There's an error "Unknown type name 'NS_ASSUME_NONNULL_BEGIN'" when I build the project.
What I do:
create a demo project 'SqlDemo'
under SqlDemo/, create Podfile
use_frameworks!
source 'http://git.oschina.net/akuandev/Specs.git'
pod 'SQLite.swift', git:'https://github.com/stephencelis/SQLite.swift.git'
# pod 'SQLite.swift/Cipher', git: ... # instead, for SQLCipher support
~
then 'pod install'
after that open SqlDemo.xcworkspace
build the project
this maybe a pretty simple error. I'm new to ios dev.

Resources