I'm updating my app to use RestKit 0.2pre3, but on the process I lost the logging system that RestKit provides, it simply doesn't show anything anymore. I use cocoapods to install RestKit.
This is my Podfile
platform :ios , '5.1'
pod 'SSPullToRefresh'
pod 'MBProgressHUD'
pod 'Facebook-iOS-SDK'
pod 'TestFlightSDK'
pod 'SDWebImage'
pod 'KISSmetrics'
pod 'CustomBadge'
pod 'GoogleAnalytics-iOS-SDK'
pod 'JSONKit'
pod 'LibComponentLogging-Core'
pod 'LibComponentLogging-LogFile'
pod 'LibComponentLogging-qlog'
pod 'LibComponentLogging-pods'
pod 'RestKit/Testing'
pod 'RestKit'
pod 'OHAttributedLabel'
And, of course, in my code I'm calling
RKLogConfigureByName("RestKit", RKLogLevelTrace);
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
RKLogConfigureByName("RestKit/CoreData", RKLogLevelDebug);
I can even make successful request and get objects mapped, but I can't watch what is my server returning, how the mapping process is performed or anything and this is vital.
I think the problem is that something is misconfigured in LCL but I can't find any clues about it.
Any ideas where the problem could be?
After a long debugging I found that LCL now comes with a set of default configurations and on LCLLogFileConfig.h I had:
// Tell LCLLogFile whether it should mirror the log messages to stderr.
#define _LCLLogFile_MirrorMessagesToStdErr /* (BOOL) */ \
NO
I set it to YES and now everything is working fine.
This behavior is caused by the following 2 pods in the Podfile:
pod 'LibComponentLogging-pods'
pod 'LibComponentLogging-LogFile'
The LibComponentLogging-pods pod causes an integration of RestKit's logging with the LibComponentLogging files which are installed via the Podfile, e.g. RestKit's log components can now be configured via the standard lcl_configure... configuration functions and RestKit will use the log writer which is configured via the Podfile (instead of its built-in log writer).
The LibComponentLogging-LogFile pod chooses the file-based log writer for LibComponentLogging. By default, this log writer doesn't mirror its messages to stderr. _LCLLogFile_MirrorMessagesToStdErr in LCLLogFileConfig.h can be used to change this behavior.
Related
I am trying to figure out why I get two different results after running pod install on what should be identical podspec files. The component is called EarlGreyApp, which had a 2.0.0 release this year. The podspec for the 2.0.0 release is here in the earlgrey2 branch of the EarlGrey repo: https://github.com/google/EarlGrey/blob/earlgrey2/EarlGreyApp.podspec
When I have this defined in the podfile (I am using Demo/EarlGreyExample to reproduce) :
target 'EarlGreyExampleSwift' do
pod 'EarlGreyApp', '2.0.0'
end
It correctly modifies this section of EarlGreyExample.xcodeproj/project.pbxproj to reference EarlGrepApp's AppFramework.framework component:
/* Begin PBXShellScriptBuildPhase section */
4D216774E658C2E4470F936E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-EarlGreyExampleSwift/Pods-EarlGreyExampleSwift-frameworks.sh",
"${PODS_ROOT}/EarlGreyApp/AppFramework.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppFramework.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-EarlGreyExampleSwift/Pods-EarlGreyExampleSwift-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
However when I change the podfile to point to the branch:
target 'EarlGreyExampleSwift' do
pod 'EarlGreyApp', :git => 'https://github.com/google/EarlGrey.git', :branch => 'earlgrey2'
end
The above section does not get generated into the project.pbxproj file.
I am at a loss to explain why as the podspec registered for EarlGreyApp should be the same. When I do pod spec cat EarlGreyApp I see the same contents as what is in the earlgrey2 branch.
pod spec cat EarlGreyApp --show-all
Shows me that there are only two Podspecs available, 2.0.0 and 2.0.0-rc
Any ideas on what the difference could be?
The reason for this is because the Podspec is not published through the earlgrey2 branch it is published through the earlgrey2pod branch.
The reason for this is some users want to use EarlGrey without CocoaPods and some want to use it with. The two branches have subtle differences to allow for both use cases (compiling issues).
Additionally there are further intricacies with CocoaPods when you do a manual pod install, as you did when you referenced the github directly. I would recommend not trying that. Since EarlGreyApp is compiled as a Framework you cannot just do that unfortunately (you can with EarlGreyTest which is compiled from source). CocoaPods has poor undefined behavior in this regard.
pod repo push iOS_FS iOS_FS.podspec
Validating spec
-> iOS_FS (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
And trying to add in my project pod 'iOS_FS'. it's not working saying not available. How get know whether my library has been publish successfully or not.
I am able to create own iOS cocoa pod. follow below steps.
How to create your own pod file and shared it with other developers.
Create and public own pod.
Step 1:-
Create pod file in a local directory by running the below command.
pod spec create podspecificationfileName
Example:
pod spec create iOSUtilis
After creating file do configuration of target version, tag, code sync, dependency of other framework.
Step 2: once you make sure your code is compiling and well working
Create tag of your branch like below
git tag 0.0.1
git push origin 0.0.1
And update tag number in iOSUtilis.podspec file
Step 3: run command:
pod spec lint iOSUtilis.podspec
Result will be:
iOSUtilis.podspec passed validation
Step 4: publish you pod to online
Run command.
pod trunk push iOSUtilis.podspec
Result will be:
๐ Congrats
๐ iOSLoader (0.0.1) successfully published
๐
September 28th, 20:27
๐ https://cocoapods.org/pods/iOSLoader
๐ Tell your friends!
MacBook-Pro:iOSUtilis chandrakant$
How to create another version of pod.
Step 1: Just make changes in your code and validate the working.
Step 2. Create another version of tag
git tag 0.0.2
git push origin tag 0.0.2
Step 3. Update new tag version in iOSUtils.podspec
Run command
pod spec lint iOSUtils.podspec
Still getting error fix
Delete tag
git tag -d tagName
git push origin tagName
Clear cache
pod cache clean --all
Fix error in origin branch and again create tag and do the remaining process when get success โiOSUtilis.podspec passed validationโ
Step 4. Final step
Run command
pod trunk push iOSUtils.podspec
I'm receiving "[!] An internal server error occurred. Please check for any known status issues at https://twitter.com/CocoaPods and try again later." when trying to push a new version of my pod NRSPieChart. I just created this last night and it's the my first time creating my own pod. Everything seemed to have worked on the first submission. Today I updated my version in order to expand my example project and expand my README.md file to provide better Usage instructions. Upon trying to push to Trunk though I get the above error. Since I'm new to this my assumption is I've done something wrong rather than coincidentally there's an error with the spec repo?
I saw one reference to the s.source tag might need a hard code tag string. I tried that but same problem. This is the before (commented line) and after of that attempt:
# s.source = { :git => 'https://github.com/neils4fun/NRSPieChart.git', :tag => s.version.to_s }
s.source = { :git => "https://github.com/neils4fun/NRSPieChart.git", :tag => "0.1.1" }
Update: I tried again "later" as the error message suggested and it's now working. I made no changes to my pod code or pod spec, so chalk this up to something internal on the cocoa pods side of the fence.
How can I use the pods files from a remote SVN server, a private server protected by username and password, after creating the complete structure needed for Cocoapods ?
thanks
Update
Move the all sources inside a sub-directory named with version of sources (eg trunk/2.0.0) and declare it on pod like below :
pod 'MyLibrary', :svn => 'http://svn-your-ip/svn/MyLibrary/trunk/2.0.0'
The easiest variant would be to create a local checkout, and then reference the path like so:
pod 'AFNetworking', :path => '~/Documents/AFNetworking'
I have some apps that are quite similar. Therefore, I'd like to create a or some private pod(s) containing all common reusable code. My first version contains some networking functionality that uses AFNetworking and also uses KeychainItemWrapper:
Pod::Spec.new do |s|
s.name = 'CommonLib'
s.version = '0.0.1'
s.homepage = '****'
s.summary = 'My Common lib'
s.description = 'Library with common code'
s.author = { "Rens Verhage" => "*****" }
s.platform = :ios, '5.0'
s.source = { :git => "ssh://****/CommonLib.git", :tag => s.version.to_s }
s.source_files = 'CommonLib/*.{h,m}'
s.requires_arc = true
s.dependency 'AFNetworking', '~> 1.3.1'
s.dependency 'KeychainItemWrapper', '~> 1.2'
end
Running pod spec lint CommonLib.podspec gives a couple of WARN and NOTE messages:
-> CommonLib (0.0.1)
- WARN | Missing required attribute `license`.
- WARN | Missing license type.
- NOTE | [xcodebuild] AFNetworking/AFNetworking/AFHTTPClient.h:84:9: warning: SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available. [-W#pragma-messages]
- NOTE | [xcodebuild] AFNetworking/AFNetworking/AFHTTPClient.h:89:9: warning: MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. [-W#pragma-messages]
- NOTE | [xcodebuild] CommonLib/CommonLib/NSArray+NSArray_PerformSelector.m:19:35: warning: performSelector may cause a leak because its selector is unknown [-Warc-performSelector-leaks]
- NOTE | [xcodebuild] CommonLib/CommonLib/NSArray+NSArray_PerformSelector.m:19:51: note: used here
- WARN | [iOS] Unable to find a license file
Analyzed 1 podspec.
[!] The spec did not pass validation.
Notice there are no ERROR messages, but the spec doesn't pass validation however. I don't really no where to go from here. The message that the SystemConfiguration and MobileCoreServices frameworks are missing looks like an error to me. I tried fixing this warning by adding
s.ios.frameworks = 'MobileCoreServices', 'SystemConfiguration'
to my podspec, but that doesn't work.
So, two questions in one:
What is the error that keeps my podspec from passing validation?
How can I fix the warning about missing frameworks?
Recently I had this problem and adding --allow-warnings fixes the issue.
pod spec lint MyProject.podspec --allow-warnings
Ok. Got my answer from the Cocoapods guys. Podspec validation fails on all errors and warnings. Failing on warnings doesn't mean the project fails as a Pod. Turns out I can simply ignore the warning.
As for AFNetworking, the issue has been resolved with version 2.0.
[Updated]
Follow cocoapods guide to configure you podspec file and resolve the error if you are getting any and while validating it, If you are getting warnings only and if you just want to ignore it then yes you can do it by running following command.
Validating podspec with warnings
Add--allow-warningsat the end it will forcefully validate podspec.๐๐ป
pod spec lint your_project_name.podspec --allow-warnings
Push podspec repo with warnings
Make sure that you have added your repo, if not run the following command (ignore it, if you have already added it)
pod repo add your-pods pods_git_url
For Pushing podspec to repo use this ๐๐ป
pod repo push your-pods your_project_name.podspec --allow-warnings