NSLog(@"Before: %d",currentArticle);
currentArticle--;
NSLog(@"SUBTRACT %d",currentArticle);
Run Code Online (Sandbox Code Playgroud)
"currentArticle"是一个整数.这只是在我的控制台中回显一次.如果我不运行此减法,则数字"currentArticle"保持为7.
这是在主线程中运行,每个用户交互只运行一次.
我也试过了
currentArticle = currentArticle - 1;
Run Code Online (Sandbox Code Playgroud)
结果相同.我服用疯狂的药吗?
谢谢!
编辑:
声明如下:
extern int *currentArticle;
Run Code Online (Sandbox Code Playgroud)
稍后分配为:
currentArticle = 0;
Run Code Online (Sandbox Code Playgroud)
我尝试重写为:
int *curArticle; // in my .h file
curArticle = 1;
Run Code Online (Sandbox Code Playgroud)
然后我跑了
curArticle--;
Run Code Online (Sandbox Code Playgroud)
它仍然减少两个......
我已经逐步完成了代码并确保没有其他调用这个变量.感谢您的反馈到目前为止,我会继续抨击它.
我在Objective C中使用FMDatabase SQLite包装器,我有以下问题:
我正在后台线程中运行XML解析和数据库插入,以获取用户无权访问的某些内容,但是用户可以从他们所在的部分与UI和数据库进行交互.
The FMDatabase <FMDatabase: 0x17b7b0> is currently in use.
Run Code Online (Sandbox Code Playgroud)
随机地,我将得到一个"已使用的FMDatabase"通知,数据库将永远不会填充该数组.我的印象是FMDatabase类一旦获得免费就会处理它,但我有一个:
while(contents.count < 1){
sleep(1);
}
Run Code Online (Sandbox Code Playgroud)
希望一旦数据库释放,就会填充数组.我还尝试重新运行阵列填充脚本,如果数据库忙,但无济于事.
对不起,如果这个问题令人困惑,我很乐意澄清.
我可以更新detailTextLabel.text,UITableViewCell在运行时显示更改,但如果我尝试更新imageView.image,它不会更改可见图像.知道为什么?我曾尝试在UITableViewCell上调用刷新,但无济于事.
-(void)getImageForURL:(NSURL*)url row:(UITableViewCell*)cell {
UIImage*image;
image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url];
cell.imageView.image = image; // Does not work..
cell.detailTextLabel.text = @"test"; // Works
}
Run Code Online (Sandbox Code Playgroud) 以下是我的AppDelegate:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
customViewController = [[CustomViewController alloc] initWithNibName:@"CustomViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:customViewController];
[self.navigationController setNavigationBarHidden:YES];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)
在实际的XIB中,视图与"文件所有者"相关联,这是我唯一的关联.
XIB层次结构:
Navigation Controller
- View Controller - Root View Controller
-View (Associated with File's Owner)
Run Code Online (Sandbox Code Playgroud)
对不起,如果我不明白这一点,它在以前推出的应用程序上工作正常,但我明白这并不意味着它是正确的.
编辑:对不起,这是我得到的错误:
*由于未捕获的异常'UIViewControllerHierarchyInconsistency'终止应用程序,原因:'视图一次最多只能与一个视图控制器关联!查看<UIView:0xa192d00; frame =(0 20; 320 460); autoresize = W + H; layer = <CALayer:0xa192d60 >>与<UIViewController:0xa195c70>相关联.在将此视图与<CustomViewController:0xa1802a0>关联之前清除此关联.
iphone objective-c uiviewcontroller uinavigationcontroller ios6
我是Objective-c的半新手,并且混淆了为什么我的NSMutableDictionary没有保留信息.我在头文件中声明我的变量:
@interface view_searchResults : UIViewController <UITableViewDataSource, UITableViewDelegate> {
NSMutableDictionary *imageDicationary;
}
@property (nonatomic, retain) NSMutableDictionary *imageDictionary;
Run Code Online (Sandbox Code Playgroud)
然后在我的.m文件中,我有以下内容:
@synthesize imageDictionary;
-(UIImage *)getImageForURL:(NSURL*)url {
UIImage*image;
image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
[imageDictionary setObject:image forKey:@"test"];
if([imageDictionary objectForKey:@"test"]){
NSLog(@"Exists");
}
}
Run Code Online (Sandbox Code Playgroud)
显然还有其他代码支持这一点,但我可以确认正在传递URL,并且文件正在其他地方正确下载.此外,我可以确认此函数正在执行,我不是指文档中任何其他位置的NSMutableDictionary.
谢谢!
我已经对证书进行了三次检查,看来我的问题可能在于 php-passbook 库输出的格式。
\n\n系留时通过控制台发出错误消息:
\n\nDec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: Invalid data error reading pass PASS-TYPE-IDENTIFIER/6731247236. The passTypeIdentifier or teamIdentifier provided may not match your certificate, or the certificate trust chain could not be verified.\nDec 6 09:27:33 JOHNs-iPhone MobileSafari[972] <Warning>: PassBook Pass download failed: The pass cannot be read because it isn\xe2\x80\x99t valid.\nRun Code Online (Sandbox Code Playgroud)\n\n执行:
\n\n // Create an event ticket\n $pass = new EventTicket($event[\'Order\'][\'transaction_id\'], $event[\'Event\'][\'EventDetail\'][\'visible_name\']);\n $pass->setBackgroundColor(\'rgb(60, 65, 76)\');\n $pass->setLogoText(\'LOGO\');\n\n // Create pass structure\n $structure = new Structure();\n\n …Run Code Online (Sandbox Code Playgroud)