Tag: objective c

在没有Mac的情况下学习Objective C.

我没有Mac或iPhone。 然而,采用C并使其更具动态性的概念对于smalltalk,python或ruby来说对我来说真的很有吸引力。 我想从目标C开始。 客观C只是C的语法超集还是它真的像C一样。它可以用gcc等编译吗? 我在Ruby中编写了大部分的编程。 Objective C似乎比C更宽容。你可以用C编写Ruby的原生扩展。你能在Objective C中编写Ruby的原生扩展吗? 如何在拥有Mac / iPhone和拥有XCode之外开始使用Objective C?

无法在Yosemite DP 7上安装Cocoapods

我在安装在单独分区上的Yosemite DP 7上安装Cocoapods时遇到问题。 我已经尝试按照Cocoapods上的指令使用Xcode 6和10.10 Yosemite,并且在问题( https://github.com/CocoaPods/CocoaPods/issues/2219 )中由于Stack Overflow链接上提出的相同解决方案而关闭。 我继续收到以下错误: Rasmuss-MacBook-Pro:~ rasmusth$ sudo gem install cocoapods Building native extensions. This could take a while… ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension. “/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby” -rubygems /Library/Ruby/Gems/2.0.0/gems/rake-0.9.6/bin/rake RUBYARCHDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext RUBYLIBDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb checking for -std=c99 option to compiler… *** extconf.rb failed *** Could not create […]

使用任何东西在Ruby中的Objective-C / Decrypt中加密

我们使用此代码在iPhone上的Objective-C中进行加密: – (NSMutableData*) EncryptAES: (NSString *) key { char keyPtr[kCCKeySizeAES128+1]; bzero( keyPtr, sizeof(keyPtr) ); [key getCString: keyPtr maxLength: sizeof(keyPtr) encoding: NSUTF8StringEncoding]; size_t numBytesEncrypted = 0; NSUInteger dataLength = [self length]; size_t bufferSize = dataLength + kCCBlockSizeAES128; void *buffer = malloc(bufferSize); NSMutableData *output = [[NSData alloc] init]; CCCryptorStatus result = CCCrypt( kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, keyPtr, kCCKeySizeAES128, […]

针对iPhone Native应用程序的测试驱动设计

我正在试验iPhone SDK并做一些TDD ala Dr. Nic的rbiPhoneTest项目。 我想知道有多少(如果有的话)成功使用这个或任何其他测试框架的iPhone / Cocoa? 更重要的是,我想知道如何最好地断言专有的二进制请求/响应协议。 想法是通过网络发送二进制请求并接收二进制响应。 使用byte和’ing和oring创建请求和响应。 我正在使用黄金副本模式来测试我的请求。 这是我到目前为止所拥有的。 不要笑,因为我是btoh Objective C和Ruby的新手: require File.dirname(__FILE__) + ‘/test_helper’ require ‘fileutils’ require ‘io’ require “MyModel.bundle” OSX::ns_import :MyModel module MyTestExtensions def is_absolute_path(path) return /^\/.*/.match(path) end def parent_directory(file) dir = file if(! is_absolute_path(dir)) dir = File.expand_path(dir) end dir = File.dirname(dir) assert is_absolute_path(dir), “Expecting an absolute path […]