小编ahm*_*mad的帖子

更新后无法使用cocoapods

我在mac OSX 10.9.5上更新了Ruby,Gems和Cocoapods,更新后我无法执行命令

pod install
Run Code Online (Sandbox Code Playgroud)

我从终端得到以下错误

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.2/lib/cocoapods/user_interface/error_report.rb:13:in `report': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.2/lib/cocoapods/command.rb:61:in `report_error'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.2/lib/cocoapods/command.rb:48:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.34.2/bin/pod:33:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我创建了一个包含以下内容的Podfile

platform :ios, ‘7.1’

pod 'AFNetworking', '~> 1.3.3’
Run Code Online (Sandbox Code Playgroud)

Cocoapods在更新前完美运作.任何帮助是极大的赞赏.

ruby macos gem ios cocoapods

10
推荐指数
1
解决办法
2412
查看次数

将键盘布局更改为表情符号

当UITextField成为第一个响应者时,是否可以将键盘布局更改为表情符号?或者根据用户操作,例如点击UIButton

我知道我可以将键盘布局更改为其中一个

typedef enum {
UIKeyboardTypeDefault,                // Default type for the current input method.
UIKeyboardTypeASCIICapable,           // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
UIKeyboardTypeNumbersAndPunctuation,  // Numbers and assorted punctuation.
UIKeyboardTypeURL,                    // A type optimized for URL entry (shows . / .com prominently).
UIKeyboardTypeNumberPad,              // A number pad (0-9). Suitable for PIN entry.
UIKeyboardTypePhonePad,               // A phone pad (1-9, *, 0, #, with letters under the numbers).
UIKeyboardTypeNamePhonePad,           // A type optimized for entering a person's …
Run Code Online (Sandbox Code Playgroud)

uikit uikeyboard ios emoji uikeyboardtype

6
推荐指数
3
解决办法
4307
查看次数

CGContextStrokePath 在 iOS &gt; 5 中触发 EXC_BAD_ACCESS

我有一个自定义 UIButton 类,它为 UIButton 添加渐变和光泽效果,代码在 iOS 4 和 iOS5 模拟器上完美运行,但是当我在 iOS 5 设备上运行它时,它给了我异常 EXC_BAD_ACCESS ,异常由线 :

CGContextStrokePath(context);
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助,这是我的代码

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();

    CGFloat actualBrightness = _brightness;
    if (self.selected) {
        actualBrightness -= 0.10;
    }   

    CGColorRef blackColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0].CGColor;
    CGColorRef highlightStart = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.7].CGColor;
    CGColorRef highlightStop = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0].CGColor;

    CGColorRef outerTop = [UIColor colorWithHue:_hue saturation:_saturation brightness:1.0*actualBrightness alpha:1.0].CGColor;
    CGColorRef outerBottom = [UIColor colorWithHue:_hue saturation:_saturation brightness:0.80*actualBrightness alpha:1.0].CGColor;

    CGFloat outerMargin = 7.5f; …
Run Code Online (Sandbox Code Playgroud)

exc-bad-access objective-c quartz-2d ios4 ios5

5
推荐指数
1
解决办法
1171
查看次数

格式化NSDate对象会更改时区

我使用以下代码在用户时区中获取当前的NSDate

-(NSDate *)getCurrentDateinLocalTimeZone
{
NSDate* sourceDate = [NSDate date];

NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:sourceDate];
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:sourceDate];
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;

NSDate* destinationDate = [[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate] ;

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";

return   [dateFormatter dateFromString: [dateFormatter stringFromDate:destinationDate]];
}
Run Code Online (Sandbox Code Playgroud)

在我的应用程序中的其他一点,我想将日期格式化为"HH:mm"用于UI目的,所以我使用以下方法

-(NSString *)formatDate:(NSDate *)date
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
dateFormatter.dateFormat = @"HH:mm";
return [dateFormatter stringFromDate:date]; 
}
Run Code Online (Sandbox Code Playgroud)

如果第二种方法的输出从第一种方法的结果移动了3个小时,,,我只想改变NSDate的格式而不是时间,我做错了什么?

cocoa-touch nsdate nsdateformatter ios

3
推荐指数
1
解决办法
5208
查看次数

使用运行脚本比较 info.plist 中的值

我的 info.plist 文件中有两个值,比如说 string1 , string 2

我想添加一个运行脚本来比较两个值并在值不相等时调用构建错误。

我是脚本的新手,因为我面临一些语法问题,这是我到目前为止所完成的

set string1 to $(/usr/libexec/PlistBuddy -c "Print string1" "${PROJECT_DIR}/${INFOPLIST_FILE}")
set string2 to $(/usr/libexec/PlistBuddy -c "Print string2" "${PROJECT_DIR}/${INFOPLIST_FILE}")

echo string1
echo string2

if string1 = string2 then
echo "no errors" else
echo "generate build error in xcode"
Run Code Online (Sandbox Code Playgroud)

任何指针都受到高度赞赏。谢谢

shell xcode

1
推荐指数
1
解决办法
2332
查看次数