所以我git diff --check在add-ing文件和commit-ing它们之前运行,并在我得到的两个特定文件上运行path/filename:linenumber: new blank line at EOF.如果我删除这些文件中的最后一个空行,我不会收到任何消息,但我认为使用换行符结束文件是一种很好的方式.奇怪的是,我认为其他文件具有完全相同的结尾,不会给出任何消息.我是git的新手,在OS X Yosemite上使用git 2.0.1.我使用vim作为我的编辑.
如何在避免此消息的同时以换行符结束我的文件?我应该忽略它吗?
在Mac OS上,如果我跑clang --version,我得到:
Apple LLVM version 6.0 (clang-600.0.34.4) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
Run Code Online (Sandbox Code Playgroud)
由于LLVM官方页面显示当前的LLVM版本为3.5,因此Apple clang版本似乎与开源LLVM不同.输出(based on LLVM 3.5svn)表明我的机器上可能也是3.5.
现在我来到这里,因为我想编译一个C++ 14文件,使用g++ -std=c++14 main.cc.此页面表明此选项应适用于clang 3.5.但是,它仅-std=c++1y适用于clang 3.4或更早版本.
那么什么是LLVM开源版本等同于Apple的版本?它似乎3.5但是为什么它不起作用呢?
在iPhone模拟器和iPhone 3GS(iOS 6)上,我都无法将方向设置为纵向颠倒.我只有一个ViewController.我在其中添加了此代码:
-(BOOL) shouldAutorotate{
return YES;
}
-(UIInterfaceOrientation) preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortraitUpsideDown;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown;
}
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
if (toInterfaceOrientation==UIInterfaceOrientationPortrait || toInterfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {
return YES;
}
return NO;
}
Run Code Online (Sandbox Code Playgroud)
我还将此添加到AppDelegate.m:
-(NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown;
}
Run Code Online (Sandbox Code Playgroud)
我还检查了plist文件,两个方向都存在.在我的故事板上,在Simulated Metrics Orientation设置为Inferred.我在applicationDidFinishLaunchingWithOptions中什么都不做,除了返回YES.我刚刚在这个ViewController中添加了一个UIImageView.是否有可能使这个方向有效?
我安装了CocoaPods,它说Successfully installed cocoapods-0.33.1,但无论我试图用pod命令做什么,比如pod install,我得到以下控制台输出:
Max$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:6:in `rescue in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj/ext.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/lib/xcodeproj.rb:30:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/lib/cocoapods.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.33.1/bin/pod:32:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from …Run Code Online (Sandbox Code Playgroud)