小编or *_*ran的帖子

如何在NSDate中添加一个月?

如何将月添加到NSDate对象?

NSDate *someDate = [NSDate Date] + 30Days.....;
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsdate ios

74
推荐指数
4
解决办法
5万
查看次数

在Xcode 4.1中添加自定义字体

我想在y应用程序中使用自定义字体.

我在info.Plist文件中声明了"应用程序提供的字体"

并将label.font设置为带/不带.TTF扩展名的字体

将TTF文件拖入项目并将文件复制到项目中

为标签创造了一个出口,但仍然没有任何作用.

如果有人知道那边发生了什么,我想得到一些帮助.

最近我注意到这个问题已知为@ 4.1(xcode版本).

TNX :)

iphone objective-c uilabel uifont xcode4

16
推荐指数
2
解决办法
2万
查看次数

连续旋转UIImageView

我在试图UIImageview连续旋转球内部的图像时出现问题.我希望这个球在其中心轴上连续旋转.我尝试过使用CGAffineTransform但它没有用.

请帮忙!

iphone animation cocoa-touch objective-c ios

15
推荐指数
2
解决办法
1万
查看次数

阅读NSURLresponse

我发送一个对象给这个adrees: https://sandbox.itunes.apple.com/verifyReceipt

NSUrlconnection ,我试图用这个委托方法来阅读:

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 像这样 :

NSlog(@"%@",response); 我得到这个代码:

<NSHTTPURLResponse: 0x7d2c6c0> 我需要以某种方式得到一个字符串.我该怎么读?

xcode cocoa-touch objective-c nsurlconnection ios

14
推荐指数
2
解决办法
4万
查看次数

如何对AFNetworking请求进行单元测试

我正在GET请求检索JSON数据,AFNetworking如下面的代码:

        NSURL *url = [NSURL URLWithString:K_THINKERBELL_SERVER_URL];
    AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
    Account *ac = [[Account alloc]init];
    NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:[NSString stringWithFormat:@"/user/%@/event/%@",ac.uid,eventID]  parameters:nil];

    AFHTTPRequestOperation *operation = [httpClient HTTPRequestOperationWithRequest:request
                                                                            success:^(AFHTTPRequestOperation *operation, id responseObject) {
                                                                                NSError *error = nil;
                                                                                NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:&error];
                                                                                if (error) {
                                                                                }

                                                                                [self.delegate NextMeetingFound:[[Meeting alloc]init] meetingData:JSON];

                                                                            }
                                                                            failure:^(AFHTTPRequestOperation *operation, NSError *error){
                                                                            }];
    [httpClient enqueueHTTPRequestOperation:operation];
Run Code Online (Sandbox Code Playgroud)

问题是我想基于这些数据创建单元测试,但我不希望测试实际上会发出请求.我希望预定义的结构将作为响应返回.我是一个新的单元测试,并戳了一点,OCMock但无法弄清楚如何管理这个.

unit-testing ocmock ios afnetworking

9
推荐指数
1
解决办法
5281
查看次数

UITableViewCell做了电子事件延迟

UITableViewCell在我的子课程中UITableView.我之前做了大约一千次,但现在我想抓住这个委托活动:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath;
Run Code Online (Sandbox Code Playgroud)

触摸单元格时,应调用此回调.但我只是在触摸后按下6秒或6次,但不是每次触摸都会调用.

tableview是一个子类的子视图,UIView我在下面调用它awakeFromNib:

-(void)awakeFromNib{
_table_view.delegate = self;
_table_view.dataSource = self;
}
Run Code Online (Sandbox Code Playgroud)

tableview自己很好,但这个事件运作不佳.有任何想法吗?

这是UITableViewCell子类代码.m

#import "FLBlockedPersonCell.h"

@implementation FLBlockedPersonCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
    [super setHighlighted:highlighted animated:animated];
}



@end
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

7
推荐指数
2
解决办法
2407
查看次数

项目导航器Xcode 5中的问号

我刚刚更新到Xcode5并且我的项目正在使用GIT,更新完成后,每个文件附近的项目导航器文件中突然出现问号.

在此输入图像描述

当我试图Commit我没有看到什么文件被更改,我也不能拉,当我试图推动它给:推动成功"消息,但存储库上GitHub没有更新.

git ios xcode5

6
推荐指数
1
解决办法
2637
查看次数

Unity3D不安全代码需要指定`unsafe'命令行选项

我正在使用Unity3D 4.3并调用DLL我创建的那个.当试图调用它所拥有的唯一函数时,这是:

void GetModelReferences(int &nVertices, float * vertices, int &nTriangles, int * triangles, float * normals, float * uvCoordinates);
Run Code Online (Sandbox Code Playgroud)

团结给了我一个错误:

Unsafe code requires the `unsafe' command line option to be specified
Run Code Online (Sandbox Code Playgroud)

所以在我MonoDevelop打开的时候:Project->Assembly-Csharp options打开unsafe模式.

它减少了部分错误,但最后一个不会消失

Unsafe code requires the `unsafe' command line option to be specified
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

c# dll unsafe unity-game-engine

6
推荐指数
2
解决办法
2万
查看次数

如何从C方法调用Objective-C"self"

Objective-C在我的iOS项目中有类,它在同一个类中实现Objective-CC编码.我将扩展名改为.mm,这部分进展顺利.现在我想设置一个C方法来调用Objective-C同一个类中的方法.我得到的问题是当我尝试self从该C方法调用时.这是代码:

void SetNotificationListeners(){
    [self fireSpeechRecognition];
}
Run Code Online (Sandbox Code Playgroud)

错误是:

Use of undeclared identifier 'self'
Run Code Online (Sandbox Code Playgroud)

我该怎么办呢?

c objective-c ios

5
推荐指数
1
解决办法
5952
查看次数

应用关闭后如何处理推送有效负载?

我正在向我的用户发送推送有效负载,其中包含以下内容:

{"aps": {"alert": "Go To Google", "sound": "Default","url":"http://www.google.com"}}
Run Code Online (Sandbox Code Playgroud)

当pp运行但在后台时,一切顺利.如果我收到推送并且应用程序已关闭,我打开它并且没有任何反应.我正在尝试重定向到有效负载中的此URL.当应用程序从后台运行时它再次运行良好.

这是到目前为止AppDelegate.m的实现:

-(void)Redirect:(NSString*)url{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; 
    NSLog(@"%@",url);
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {    
    RedirectedUri = [[userInfo objectForKey:@"aps"] objectForKey:@"url"];
    NSLog(@"%@",RedirectedUri);
    [self Redirect:RedirectedUri];    
  }
Run Code Online (Sandbox Code Playgroud)

需要一些帮助.

iphone push-notification ios

4
推荐指数
1
解决办法
1528
查看次数