借助Google Analytics for iOS v2,Google建议将其GAITrackedViewController
类继承为子类UIViewController
.在UITableViewController的情况下我们做什么?
#import "GAITrackedViewController.h"
@interface AboutViewController : GAITrackedViewController
Run Code Online (Sandbox Code Playgroud) 简短的背景故事,我们以前的开发人员使用ASIHTTPRequest发出POST请求并从我们的Web服务中检索数据.由于未知原因,我们的应用程序部分停止工作.似乎有足够的时间来进行未来的证明并与AFNetworking一起使用.REST webservice在CakePHP框架上运行.
简而言之,我没有使用AFNetworking接收请求响应字符串.
我知道web服务有效,因为我能够成功发布数据并使用curl接收正确的响应:curl -d"data [Model] [field0] = field0value&data [Model] [field1] = field1value" https://example.com /api/class/function.plist
根据之前开发人员的说明,我提出了以下建议.
#import "AFHTTPRequestOperation.h"
…
- (IBAction)loginButtonPressed {
NSURL *url = [NSURL URLWithString:@"https://example.com/api/class/function.plist"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[usernameTextField text] forHTTPHeaderField:@"data[User][email]"];
[request setValue:[passwordTextField text] forHTTPHeaderField:@"data[User][password]"];
AFHTTPRequestOperation *operation = [[[AFHTTPRequestOperation alloc] initWithRequest:request] autorelease];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"operation hasAcceptableStatusCode: %d", [operation.response statusCode]);
NSLog(@"response string: %@ ", operation.responseString);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error: %@", operation.responseString);
}];
[operation start]; …
Run Code Online (Sandbox Code Playgroud) 尝试本地化项目(最初在Xcode 6中创建)后,我在调试导航器中看到一个模糊的错误.
"无法打开文件"Main.strings",因为没有这样的文件."
在尝试选择文件时,我会收到提醒.
"无法打开文档"Main.storyboardc".Interface Builder无法打开已编译的nib."
作为一个完整性检查,我使用相同的设置(使用NSLocalizedString
)创建了一个新项目,并运行了上面列出的相同步骤.我为其他语言提供了替代翻译,然后构建并运行了按预期工作的项目,显示了字符串的备用翻译.
我已经尝试过这个答案,但问题和答案并不完全适用于我所看到的问题.
我在这里不知所措.有什么建议?
瘦:我的应用程序在iOS 5.x中运行良好.但是,某些功能在4.x中运行不佳.所有问题都通过5.x更新解决.
选项1 - 优秀的程序员:了解我的应用程序中使用这些特定功能所做的工作以及它们在4.x中不起作用的原因.
选项2 - 懒惰的程序员:检测用户正在运行的iOS版本(我已经知道不建议这样做)并建议他们升级,如果它更旧.更进一步,通过使用iPhone URL(例如:iossettings://)引导他们进行设置/软件更新.
非常感谢您的建议.
ios ×3
iphone ×3
afnetworking ×1
cakephp ×1
ipad ×1
localization ×1
post ×1
rest ×1
xcode ×1
xcode7 ×1