我试图在目标c中实现这样的目标.
@try{
//some code that will raise exception
}
@catch(CustomException e){//How to create this
//catching mechanism
}
@catch(NSException e){
//Generic catch
}
Run Code Online (Sandbox Code Playgroud)
我需要创建CustomException类并使用它.你能帮我创建一下这个CustomException并指导我如何使用它.
提前致谢.
团队,我正在使用NSDateFormatter将字符串形成的日期与iOS系统日期进行比较.当系统日期时间设置设置为24小时时间时,以下语句返回true,但相同的代码在24小时时间关闭时返回false.
有问题的代码:
if ([(NSDate*)[NSDate date] compare:currDate] == NSOrderedAscending) {
// -- Code -- This is executed only when the 4-Hour Time ON
}
Run Code Online (Sandbox Code Playgroud)
我很迷惑.我获取日期的字符串是24小时格式.这是一个问题吗?还是其他什么?
日期格式代码:
-(NSDate *)getDateFromString:(NSString *)dateString{
NSDateFormatter* fmt = [[NSDateFormatter alloc] init];
[fmt setDateFormat:@"dd MMM yyyy hh:mm:ss"];
[fmt setTimeZone:[NSTimeZone systemTimeZone]];
[fmt setFormatterBehavior:NSDateFormatterBehaviorDefault];
return [fmt dateFromString:dateString];
}
Run Code Online (Sandbox Code Playgroud) 是否可以以英寸计算android屏幕对角线尺寸.
我试过以下两种方法都不适合我的情况.
方法1:
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int absoluteHeightInPx = displayMetrics.heightPixels;
int absoluteWidthInPx = displayMetrics.widthPixels;
double diagonalPixels = Math.sqrt((absoluteHeightInPx * absoluteHeightInPx) + (absoluteWidthInPx * absoluteWidthInPx));
double diagonalInInches = diagonalPixels / displayMetrics.densityDpi;
Run Code Online (Sandbox Code Playgroud)
方法2:
float actualHeight = absoluteHeightInPx * deviceDensity;
float actualWidth = absoluteWidthInPx * deviceDensity;
float deviceDensity = displayMetrics.density;
float physicalPixelPerInchX = displayMetrics.xdpi;
float physicalPixelPerInchY = displayMetrics.ydpi;
float heightInInches = actualHeight / physicalPixelPerInchY;
float widhtInInches = actualWidth / physicalPixelPerInchX;
double diagonalInInches = Math.sqrt((heightInInches * heightInInches) + (widhtInInches * widhtInInches)); …Run Code Online (Sandbox Code Playgroud) 我需要在java中找到已弃用项的替换.我在javadoc中找到了关于每个不推荐使用的项目的一些描述.但这还不够.
更具体一点=>我需要做一个java程序,它可以读取一个java文件,并且应该替换该给定java文件中使用的弃用项(如果有的话),并且应该用适当的替换替换已弃用的项.
有没有其他来源找到它?
要么
是否有任何第三方API可用于替换已弃用的itms?
要么
在eclipse中有没有可用的选项呢? - >我的意思是例如在eclipse的问题控制台中,我们能够找到所使用的弃用项的警告.同样,eclipse中是否有任何可以显示项目中已弃用项目的替换,
请帮助我这方面.
提前致谢,
Easwar
我有一个Tab栏应用程序.我正在使用XCode 4.3.3.我用iOS6的东西升级到了4.5.2.
我在shouldAutorotateToInterfaceOrientation每个视图中的代码将检查当前的设备方向并正确放置所有UI组件.
但升级到iOS 6后,此代码未执行.我已经尝试了差不多一天来解决这个问题,但没有运气.
我也试过了
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
Run Code Online (Sandbox Code Playgroud)
在viewLoad,viewDidLoad,viewWillAppear
如果我想在视图加载期间检查方向,并在视图加载期间将UI组件放置到适当的位置,我该怎么办?请提出你的建议.
谢谢
我的要求是使用HTTP Servlet将PDF数据响应到移动客户端(iPhone).
我用以下方式做了,但是我没有在客户端获得预期的输出.
PrintWriter out = response.getWriter();
String aInputFileName = "/Users/hcl/Desktop/Easwar/sample.pdf";
log("Reading in binary file named : " + aInputFileName);
File file = new File(aInputFileName);
log("File size: " + file.length());
byte[] result = new byte[(int)file.length()];
System.out.println("Length : "+ result.length);
try {
InputStream input = null;
try {
int totalBytesRead = 0;
input = new BufferedInputStream(new FileInputStream(file));
while(totalBytesRead < result.length){
int bytesRemaining = result.length - totalBytesRead;
//input.read() returns -1, 0, or more :
int bytesRead = input.read(result, totalBytesRead, bytesRemaining);
if (bytesRead …Run Code Online (Sandbox Code Playgroud) 我必须从FTP中提取一组图像.
我通过给出图像的服务器URL来尝试与tomcat服务器相同的东西,它看起来快速而且好.为了研究从FTP服务器提取的FTP文件,从Apple SimpleFTPSample获得了一个样本
在示例中,有一个代码从FTP中提取图像,但是它太慢而无法提取图像.
为什么它花了这么多时间用于一张图片?如果我必须得到一些图像,我不能想象时间延迟?
谢谢,Easwar
我正在开发一个使用YouTube GData API的应用程序.这在我的项目中引发了近32个警告.
我的问题是,苹果会拒绝该应用程序多次警告吗?
他们是否认真看到这种警告?
请提出您的意见/建议......

我想知道是否有任何选项可以连接到salesforce平台中的外部数据库.
谢谢,Easwar
ios ×6
iphone ×4
ipad ×3
java ×2
objective-c ×2
android ×1
apex-code ×1
deprecated ×1
eclipse ×1
force.com ×1
ftp ×1
ios6 ×1
java-ee ×1
macos ×1
mobile ×1
nsdate ×1
salesforce ×1
servlets ×1
tomcat ×1
visualforce ×1