任何人都知道我为什么会收到此错误?
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomRaisedTabViewController cancel:]: unrecognized selector sent to instance 0x4d321e0'
Run Code Online (Sandbox Code Playgroud)
这是它失败的代码.这是我的CustomTabViewController.单击"取消"按钮时发生错误.
-(IBAction)showPostModalViewController {
PostActionModalViewController *addController = [[PostActionModalViewController alloc]
initWithNibName:@"PostActionModalView" bundle:nil];
// Configure the PostAddViewController. In this case, it reports any
// changes to a custom delegate object.
addController.delegate = self;
// Create the navigation controller and present it modally.
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];
UIBarButtonItem *cancelButton =
[[UIBarButtonItem alloc] initWithTitle: @"Cancel"
style: UIBarButtonItemStylePlain
target: self
action: @selector(cancel:)]; …Run Code Online (Sandbox Code Playgroud) 尝试使用AFNetworkings ReachabilityStatusChanged但获取
"HTTPCLIENT没有可见的@interface声明选择器setReachabilityStatusChangeBlock"
但HttpClient具有该功能.任何人都知道为什么会这样吗?
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://stat-api.herokuapp.com/"]];
[client setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status){
NSLog(@"%d", status);
}];
Run Code Online (Sandbox Code Playgroud)
///更新///////////
这是我的.pch文件
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "NSDate+Helper.h"
#import "NSEntityDescription+RKAdditions.h"
#import "UIAlertView+MKBlockAdditions.h"
#import "UIActionSheet+MKBlockAdditions.h"
#import "MKBlockAdditions.h"
#import "NSObject+MKBlockAdditions.h"
#import "NSString+Extra.h"
#import "UIView+Additions.h"
#import "ObjectiveSugar.h"
#import "NSNotificationCenter+UniqueNotif.h"
#import "STUIColor+Custom.h"
#import "NSObject+STNSObjectAdditions.h"
#import "UIView+Gradientcy.h"
#import "NSString+USStateMap.h"
#import "STUITextField.h"
#import "UIImage+UIImageCrop.h"
#import "UIBorderLabel.h"
#import <SystemConfiguration/SystemConfiguration.h>
#endif
Run Code Online (Sandbox Code Playgroud) 致力于将iOS6应用程序转换为iOS7,他们正在使用它来设置分组的tableview样式.
cell.backgroundView = aView;
cell.selectedBackgroundView = bView;
Run Code Online (Sandbox Code Playgroud)
当应用程序加载时,它会正确加载backgroundView,但是当我单击该单元格时,selectedBackgroundView在iOS7中不再有效.单击选择单元格以使其正常工作,但selectBackgroundView不会显示.
有什么建议?我唯一能想到的就是不使用selectedBackgroundView,只需在每次选中和取消选中子视图时添加和删除子视图.
///更新///
把这个在我的cellForRowAtIndex和仍然不工作.
UIView *bgColorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
bgColorView.backgroundColor = [UIColor colorWithRed:(76.0/255.0) green:(161.0/255.0) blue:(255.0/255.0) alpha:1.0]; // perfect color suggested by @mohamadHafez
bgColorView.layer.masksToBounds = YES;
cell.selectedBackgroundView = bgColorView;
Run Code Online (Sandbox Code Playgroud)
////更新2 ///////////
如果我把它放在我的cellforRowAtIndex中
cell.selectedBackgroundView = nil;
cell.backgroundView = nil;
UIView *bgColorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
bgColorView.backgroundColor = [UIColor colorWithRed:(76.0/255.0) green:(161.0/255.0) blue:(255.0/255.0) alpha:1.0]; // perfect color suggested by @mohamadHafez
bgColorView.layer.masksToBounds = YES;
cell.selectedBackgroundView = bgColorView;
UIView *bgSColorView …Run Code Online (Sandbox Code Playgroud) 我通过xcode Editor菜单创建了一个NSManagedObject.我的对象只有一个属性"name".当我尝试设置属性时,我得到"[MyObject setName:]:无法识别的选择器发送到实例"
MyObject *thing = [MyObject objectFromJSONDictionary:obj];
thing.name = obj; <-- ERROR HERE
Run Code Online (Sandbox Code Playgroud)
我已经检查过我的属性"name"在CD中和我班级中的相同.我的界面属性也一样.我的动态属性是一样的.
@property (nonatomic, retain) NSString * name;
@dynamic name;
Run Code Online (Sandbox Code Playgroud)
有什么建议?是的,我已经清除了CD对象,清理了我的项目,并再次在CD中创建了它.同样的问题?
我设置了以下方法:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
Run Code Online (Sandbox Code Playgroud)
它工作正常并被调用,但它从不包含多个位置。我试图在手机移动时获取新旧位置之间的距离。我错过了什么吗?location 数组中永远不会有两个项目。
我有一个boolean var的对象.
field :processing, :type => Boolean
Run Code Online (Sandbox Code Playgroud)
在我面前的开发人员写了一些代码说这个.
:processing => nil
Run Code Online (Sandbox Code Playgroud)
(出于某种原因,他将其设置为nil而不是false.)
然后他做了这个if语句
return if self.processing
dosomethingelse....
Run Code Online (Sandbox Code Playgroud)
如果我编写代码来执行此操作
:processing => false
Run Code Online (Sandbox Code Playgroud)
下次运行此代码时会发生什么?dosomethingelse运行吗?
return if self.processing
dosomethingelse....
Run Code Online (Sandbox Code Playgroud)
更新===========
对于下面的许多问题,我们将在此回答.
我加了这个
field :processing, :type => Boolean, :default => false
Run Code Online (Sandbox Code Playgroud)
它打破了应用程序.当我改变到上面的dosomethingelse永远不会运行?
return if self.processing回报.有什么建议?
更新2 =======================================
以下是对我的代码(编辑)中的处理的每个引用.如果重要的话,我也在使用MongoDB.
.where(:processing => nil).gt(:retries => 0).asc(:send_time).all.entries
if self.processing
end
return if self.processing
self.update_attributes(:processing => true)
dosomethingelse....
.where(:sent_time => nil).where(:processing => nil).gt(:retries => 0).asc(:send_time).all.entries
:processing => nil
Run Code Online (Sandbox Code Playgroud) 我打算将代码推送到Heroku,但构建失败
NameError: uninitialized constant Smtpapi
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/app/helpers/my_mailer_header.rb:1:in `<top (required)>'
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/lib/api_v1/users.rb:3:in `<top (required)>'
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/lib/api_v1/mymedical.rb:3:in `<class:Mymedical>'
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/lib/api_v1/mymedical.rb:1:in `<top (required)>'
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/config/routes.rb:1:in `<top (required)>'
/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/vendor/bundle/ruby/2.4.0/gems/railties-4.2.11/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
Run Code Online (Sandbox Code Playgroud)
我将Gemfile从Ruby 2.3更新为2.4,现在却遇到此错误?找不到解决方案。
这似乎是导致此问题的代码。
class MyMailerHeader < Smtpapi::Header
Run Code Online (Sandbox Code Playgroud)
Ruby 2.4.2中不存在Smtpapi吗?
Smtpapi是Send-Grid gem和其他一些gem的一部分。
sendgrid-ruby (1.1.6)
faraday (~> 0.9)
mimemagic
smtpapi (~> 0.1)
smtpapi (0.1.0)
Run Code Online (Sandbox Code Playgroud) 如何在Foursquare iPhone应用程序的所有按钮和文本字段后面绘制背景?看看它与"分享......"的位置
我有一个XIB,里面有很多视图(iPad).其中一个视图是UITableView.代表是通过IB设置的.当您运行应用程序时cellForRowAtIndex未被调用.事实上,在这个文件中,也没有numberOfRowsInSection或numberOfSections方法.只有一种didSelectRowAtIndexPath方法.
所以我写了一个cellForRowAtIndex并手动设置self.table.delegate = self.
如果我单击一个单元格didSelectRowAtIndexPath则执行.
老实说,我不知所措?这怎么可能发生?
在这样的方法中,它同步(即self或thing)?
- (BOOL)deleteThing:(MSThing *)thing error:(NSError **)error
{
@synchronized(self) {
if (!thing) {
return YES;
}
NSString *fileName = [[self thingDirectory] stringByAppendingPathComponent:thing.cacheInstanceName];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileName]) {
//...
Run Code Online (Sandbox Code Playgroud)
=== OR ===
- (BOOL)deleteThing:(MSThing *)thing error:(NSError **)error
{
@synchronized(thing) {
if (!thing) {
return YES;
}
NSString *fileName = [[self thingDirectory] stringByAppendingPathComponent:thing.cacheInstanceName];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileName]) {
//...
Run Code Online (Sandbox Code Playgroud) objective-c ×8
ios ×6
iphone ×2
ruby ×2
uitableview ×2
afnetworking ×1
core-data ×1
heroku ×1
synchronized ×1
uitextfield ×1