我正在尝试开发一个用C解决Rubik立方体的程序.我使用了回溯技术.这是一个非常漫长的过程,需要大量的迭代,所以我无法解决它.
请给我关于如何更有效地解决这个问题的建议 - 例如其他技术或采用回溯本身.在谷歌我找到了许多解决这个问题的捷径,但我不想通过使用快捷方式来解决这个问题.
我将NSXMLElement
在我的项目中使用,所以我试着
#import <Foundation/NSXMLDocument.h>
Run Code Online (Sandbox Code Playgroud)
但它给出了一个错误:"没有这样的文件或目录." 我怎么能包括这个?
我有一个应用程序,我知道双倍的范围,**1.7E +/- 308 (15 digits).**
但在我的应用程序中,我必须将文本框的值设置为100.0我的代码是
double value=[strPrice doubleValue]/100.0;
NSString *stramoount=[@"" stringByAppendingFormat:@"%0.2f",value ];
Run Code Online (Sandbox Code Playgroud)
当我将34901234566781212除以100它给我349012345667812.12但是当我键入 349012345667812124并且除以100它给我100它它给我3490123456678121.00 这是错误的我是否更改数据类型或如何更改我的代码
我正在开发一个处理Facebook的iPhone应用程序.我使用最新的SDK facebook-facebook-ios-sdk-cf1c2c3(SDK 2.0)允许用户使用OAuth登录Facebook帐户.
用户可以在设备iPod Touch(4.3.1)中毫无问题地登录.但在iPhone 3GS中我收到以下错误:
Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk." UserInfo=0x1b8350 {NSErrorFailingURLStringKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk., NSUnderlyingError=0x1b83a0 "The certificate …
Run Code Online (Sandbox Code Playgroud) 我正在将照片从iPhone相册导入到我的应用程序的文档文件夹中.这是我的代码.
for (int j=0; j<[assetArray count]; j++) {
ALAsset *assest = [assetArray objectAtIndex:j];
CGImageRef imageRef = assest.defaultRepresentation.fullResolutionImage;
UIImage *image = [UIImage imageWithCGImage:imageRef];
NSData *imageData = UIImageJPEGRepresentation(image);
[imageData writeToFile:documentsPath atomically:YES];
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但当我尝试导入更高分辨率的图像时,它需要更多的时间.以最短时间导入的正确方法是什么?顺便说一下:转换image
成转换需要更多时间NSData
.
我使用以下代码为UIDatePicker,无论选择它的日期是在标签中显示.但是我需要在选择日期后关闭选择器.这可能请建议我.
我使用以下代码:
- (void)viewDidLoad {
[super viewDidLoad];
//Create label
label = [[UILabel alloc] init];
label.frame = CGRectMake(10, 10, 300, 40);
label.textAlignment = UITextAlignmentCenter;
//Use NSDateFormatter to write out the date in a friendly format
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
label.text = [NSString stringWithFormat:@"%@",
[df stringFromDate:[NSDate date]]];
[df release];
[self.view addSubview:label];
[label release];
// Initialization code
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 250, 325, 250)];
datePicker.datePickerMode = UIDatePickerModeDate;
datePicker.hidden = NO;
datePicker.date = [NSDate date];
[datePicker addTarget:self
action:@selector(changeDateInLabel:) …
Run Code Online (Sandbox Code Playgroud) 我为我的应用程序创建了一个QuickLook Generator,并Containers/com.Aravindh.EgApp/Data/Library/QuickLook/QuickLookGenerator.qlgenerator
使用以下代码将quicklook生成器复制到此位置.
NSString *path1 = [[NSBundle mainBundle] pathForResource:@"QuickLookGenerator" ofType:@"qlgenerator"];
NSError *error;
NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask];
NSString *librayPath = [[paths objectAtIndex:0] path];
librayPath = [NSString stringWithFormat:@"%@/Quicklook/QuickLookGenerator.qlgenerator",librayPath];
if(![[NSFileManager defaultManager] fileExistsAtPath:librayPath]) {
[[NSFileManager defaultManager] copyItemAtPath:path1 toPath:librayPath error:&error];
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误:
Error Domain=NSCocoaErrorDomain Code=513 "“QuickLookGenerator.qlgenerator” couldn’t be copied because you don’t have permission to access “QuickLook”." UserInfo=0x101518250 {NSSourceFilePathErrorKey=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUserStringVariant=(
Copy
), NSDestinationFilePath=/Users/Aravindh/Library/Containers/com.Aravindh.EgApp/Data/Library/Quicklook/QuickLookGenerator.qlgenerator, NSFilePath=/Users/Aravindh/Desktop/EgApp/EgApp/build/Release/EgApp.app/Contents/Resources/QuickLookGenerator.qlgenerator, NSUnderlyingError=0x10154dbb0 "The operation couldn’t be completed. Operation not permitted"}
Run Code Online (Sandbox Code Playgroud)
我是否必须在Entitlementes.plist中提及任何内容?如何在SandBox环境中安装QuickLookGenerator?
我是xcode的新手.我有一个字符串变量和一个文本框.我想从文本框中获取字符串到字符串变量.我怎样才能做到这一点?
This is the yahoo news rss feed
<p><a href="http://us.rd.yahoo.com/dailynews/rss/us/*http://news.yahoo.com/s/ap/20110521/ap_on_re_us/us_michelle_obama_west_point"><img src="http://d.yimg.com/a/p/ap/20110520/capt.53a8af4c675f421c8b7cba014c589d29-53a8af4c675f421c8b7cba014c589d29-0.jpg?x=130&y=97&q=85&sig=iOyBvkyg0rEKSK3hjlSsNA--" align="left" height="97" width="130" alt="First lady Michelle Obama, left, and Lt. Gen. David Huntoon, superintendent at the U.S. Military Academy, arrive in Washington Hall for a graduation banquet, Friday, May 20, 2011, in West Point, N.Y. (AP Photo/Mike Groll)" border="0" /></a>AP - First lady Michelle Obama urged more than 1,000 cadets Friday night on the brink of graduating to keep in mind the families of the soldiers they will lead.</p><br clear="all"/> …
Run Code Online (Sandbox Code Playgroud) printf("%c","abcdefgh"[4]);
Run Code Online (Sandbox Code Playgroud)
以下程序的输出是e
.但我不知道它是怎么回事?我在谷歌和这里搜索了很多,但没有找到这个代码的正确解释.我对此代码的解释如下:
"这只是为了获得一个
char
.即,第4个char
开始0
.所以答案是'e'
".