我目前正在尝试使用http://sudzc.com/中的一些生成代码. 这段代码并不完全适合我的Web服务,因此我尝试将类别添加到一些生成的类中,并使用原始类替换它们的实现来自"objc/runtime.h"的method_exchangeImplementations.(我可以直接修改生成的代码,但我想避免它).
这是我在MyAppAppDelegate中执行的代码 - applicationDidFinishLaunching方法
Class theClass = [CBMayaIPhoneUser class];
Method originalMethod = class_getClassMethod(theClass, @selector(initWithNode:));
Method categoryMethod = class_getClassMethod(theClass, @selector(initWithAllStringNode:));
method_exchangeImplementations(originalMethod, categoryMethod);
theClass = [Soap class];
originalMethod = class_getClassMethod(theClass, @selector(getNodeValue:withName:));
categoryMethod = class_getClassMethod(theClass, @selector(getHrefNodeValue:withName:));
method_exchangeImplementations(originalMethod, categoryMethod);
theClass = [SoapRequest class];
originalMethod = class_getClassMethod(theClass, @selector(send));
categoryMethod = class_getClassMethod(theClass, @selector(sendIgnoringCertificate));
method_exchangeImplementations(originalMethod, categoryMethod);
originalMethod = class_getClassMethod(theClass, @selector(connectionDidFinishLoading:));
categoryMethod = class_getClassMethod(theClass, @selector(connectionDidFinishLoadingAndSentBody:));
method_exchangeImplementations(originalMethod, categoryMethod);
Run Code Online (Sandbox Code Playgroud)
正如我的问题所述,几乎所有这些class_getClassMethod都返回nil ...我使用了调试器,所以我知道'theClass'是正确设置的.找到的唯一方法是Soap类,它们都是类级(+)方法.但是从网上的各种例子中我得出的结论是,它也适用于其他人......
以下是MyAppAppDelegate.m的包含:
#import "MyAppAppDelegate.h"
#import "RootViewController.h"
#import "MyGlobalVariables.h"
#import "MyWebServiceExample.h"
#import "Soap+Href.h"
#import "SoapRequest+Certificate.h"
#import "CBMayaIPhoneUser+AllString.h"
#import …Run Code Online (Sandbox Code Playgroud) implementation exchange-server objective-c-runtime ios-simulator
我一直在开发一个应用程序,我需要以编程方式配置IPhone设置,如短信,彩信,语音和数据.在设置页面上,我需要设置短信,彩信,语音和数据的限制,这样用户就不能使用它了.
主要是为上述所有设置限制; 我google了很多,没有找到任何帮助.
可以在iPhone上做这样的事情吗?我怎么能通过私有API或IPhoneSDK来做到这一点?如果是通过私有API,请建议我该API的名称或代码.
我错过了iPhone 4上的@ 2x图形吗?
我在iPhone模拟器中运行4.0.2 SDK,但UIScreen的比例为1.0,是不是应该是2.0并自动加载高分辨率图像?
这是我正在测试的内容:
NSLog(@"system version: %@", [[UIDevice currentDevice] systemVersion]);
NSLog(@"scale factor: %.1f ", [[UIScreen mainScreen] scale]);
Run Code Online (Sandbox Code Playgroud)
它打印:
系统版本:4.0.2
比例因子:1.0
这是模拟器中的问题吗?或者我想念一些神奇的钥匙,我需要启用以使UIScreen允许2x图形?
对于我的应用程序,我设置了目标设备系列= iPhone/iPad
并在项目 - >将Active可执行文件设置为iPad模拟器,它在iPad模拟器中以1x/2x格式打开我的应用程序,因此我可以使用选项1x 2x更改大小.
现在我已经从4.1升级了我的IOS SDK到4.2
问题是:现在我的应用程序在iPad模拟器中打开,全屏尺寸(而不是1x 2x格式)并且屏幕上的所有控件位置都已更改,它破坏了应用程序的整体外观.
现在我想以相同的1x 2x scrren尺寸格式再次在iPad模拟器中打开我的应用程序.
所以现在我该怎么做?
请帮助和建议
谢谢
有人可以帮助我设置我的调试环境,这样事情会更有意义吗?
在某些时候,模拟器停止加载我正在处理的应用程序.如果我使用乐器运行它并在设备(iPad)上运行良好,该应用程序加载良好.
应用程序尝试加载,突然间我在xcode的左下角收到"调试终止"消息.
运行'tail -f /var/log/system.log'我发现以下消息:"myApp无法及时启动".
在探索和尝试断点时,我能够指出这个方法的罪魁祸首:
- (BOOL)application:(UIApplication *)
application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
Run Code Online (Sandbox Code Playgroud)
这个方法自然是app delegate的一部分,它首先执行的是:
[window addSubview:viewController.view];
Run Code Online (Sandbox Code Playgroud)
所以我的问题 - 我怎么能弄清楚这里到底发生了什么,我的应用程序的哪个部分挂了?
此外,可以使用什么样的设置从调试器获取有用的信息......
每当出现错误时,我甚至无法弄清楚生成它的代码行.
谢谢.
安装xcode ios SDK后,我现在可以运行iPhone模拟器了.现在是否可以安装和运行第三方免费iPhone应用程序,如Paper Glider,就像在真正的iPhone上一样,以及如何做到这一点?
我已经添加了popOvercontroller点击导航栏右键.我不想要动画效果..可以有人告诉我如何禁用它???
iphone iphone-sdk-3.0 ipad uipopovercontroller ios-simulator
这很奇怪.我正在iPad模拟器中刷UITableViewCell.即使下面的事件触发并且swipedCell不是nil,也不会出现"删除"按钮.实际上,它似乎 - 但有时只是.我从来没有得到过糟糕的访问或sigbart.
这是代码:
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer
{
if (userListSwipeRightRecognizer.state == UIGestureRecognizerStateEnded) {
CGPoint swipeLocation = [userListSwipeRightRecognizer locationInView:self.outletView];
NSIndexPath *swipedIndexPath = [self.outletView indexPathForRowAtPoint:swipeLocation];
UITableViewCell* swipedCell = [self.outletView cellForRowAtIndexPath:swipedIndexPath];
[swipedCell setEditing:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
这只是一个模拟器问题还是我做错了什么?
我在iphone 4中显示高分辨率图像,我将图像视图帧大小设置如下:imageFrameNormal.size.width = 470; imageFrameNormal.size.height = 625;
但它显示全屏而不是这个尺寸.所以任何人都可以建议我如何以正确的尺寸显示图像.我想在模拟器中检查它.
谢谢
ios-simulator ×10
iphone ×6
ipad ×2
iphone-4 ×2
objective-c ×2
debugging ×1
ios ×1
uitableview ×1
xcode ×1