小编pau*_*991的帖子

带有一些html标签的NSString,如何搜索<img>标签并获取url的内容

我有一个带有一些html标签的NSString,我如何搜索标签并获取网址的内容?我不确定我是否必须使用Hpple或简单的Regex表达式.在这两种情况下,我可以举一些例子吗?

regex objective-c nsstring hpple

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

如何为越狱iPhone创建一个调整

我的问题是......我们可以使用Xcode为越狱的iPhone创建调整吗?如果我想在锁定屏幕中添加一些按钮,我该怎么办?如何修改默认iPhone应用程序的GUI?

iphone xcode tweak jailbreak

3
推荐指数
1
解决办法
5661
查看次数

读取和写入plist文件的奇怪问题

我有一个应用程序从I plist文件中读取信息.要做到这一点,我使用下面的代码:

  NSData *plistData;  
    NSString *error;  
    NSPropertyListFormat format;  
    id plist;  
    localizedPath = [[NSBundle mainBundle] pathForResource:@"settings" ofType:@"plist"];  
    plistData = [NSData dataWithContentsOfFile:localizedPath];   

    plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];  
    if (!plist) {  
        NSLog(@"Error reading plist from file '%s', error = '%s'", [localizedPath UTF8String], [error UTF8String]);  
        [error release];  
    }  




    NSString *tel=[NSString stringWithFormat:@"tel:%@",[plist objectForKey:@"number"]];
    NSURL *telephoneURL = [NSURL URLWithString:tel];
    [[UIApplication sharedApplication] openURL:telephoneURL];
Run Code Online (Sandbox Code Playgroud)

写它我用这个代码:

- (IBAction) saveSetting:(id)sender{



    NSData *plistData;  
    NSString *error;  
    NSPropertyListFormat format;  
    id plist;  

    NSString *localizedPath = [[NSBundle mainBundle] pathForResource:@"settings" ofType:@"plist"];  
    plistData = [NSData …
Run Code Online (Sandbox Code Playgroud)

iphone writing objective-c plist

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

的NSDictionary.如何创建NSDictionary对象

我有这个方法.

[self postRequestWithURL: (NSString *) postArgs:(NSDictionary *) headerArgs: (NSDictionary *) ];
Run Code Online (Sandbox Code Playgroud)

我怎样才能正确调用此方法?

网址是: http://www.google.com/reader/api/0/edit-tag?

帖子args是: "a=user/-/state/com.google/read&ac=edit-tags&s=feed/%@&i=%@&T=%@", entry.link, entry.identifier, tokenString

和标题是:

NSString *authHeader = [NSString stringWithFormat:@"GoogleLogin %@", authString];
[thttpReq addValue:authHeader forHTTPHeaderField:@"Authorization"];

[thttpReq addValue:@"Content-Type" forHTTPHeaderField:@"application/x-www-form-urlencoded"];
Run Code Online (Sandbox Code Playgroud)

sompne可以帮我插入postArgs和HeaderArgs NSDictionary吗?谢谢保罗

iphone objective-c nsdictionary nsmutabledictionary

0
推荐指数
1
解决办法
4702
查看次数

目标C接收数据并将其保存为xml文件,以便在没有Internet连接的情况下进行读取

我有这种方法从谷歌阅读器获取xml文件与feed阅读器的竞争.我想在本地保存数据(我确定数据是一个xml文件)我该怎么办?我可以存储本地数据以便以后读取它而无需连接互联网?我能怎么做?谢谢

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)aResponse
{
    NSLog(@"------------------------------- connectionDidReceiveResponse");
    expectedResponseLength = [NSNumber numberWithFloat:[aResponse expectedContentLength]];
    URLresponse = aResponse;
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{   
    NSLog(@"------------------------------- connectionDidReceiveData: %@", data);
    //float l = [responseData length];
    //[delegate GoogleReaderRequestReceiveBytes:l onTotal:[expectedResponseLength floatValue]];


    //TESTING
    NSString *string = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
    NSLog(@"the  data %@",string);


    [self.responseData appendData:data];
}
Run Code Online (Sandbox Code Playgroud)

编辑**

我使用这个代码但是不起作用

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)aResponse
{
    NSLog(@"------------------------------- connectionDidReceiveResponse");
    expectedResponseLength = [NSNumber numberWithFloat:[aResponse expectedContentLength]];
    URLresponse = aResponse;
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{   
    NSLog(@"------------------------------- connectionDidReceiveData: %@", data); …
Run Code Online (Sandbox Code Playgroud)

xml iphone google-reader file objective-c

0
推荐指数
1
解决办法
804
查看次数

实现类时Objective-C错误?

我有这门课

#import <Foundation/Foundation.h>

@interface SubscriptionArray : NSObject{
    NSString *title;
    NSString *source;
    NSString *htmlUrl;
}

@property (nonatomic,retain) NSString *title;
@property (nonatomic,retain) NSString *source;
@property (nonatomic,retain) NSString *htmlUrl;

@end
Run Code Online (Sandbox Code Playgroud)

并且实现文件是这个:

#import "SubscriptionArray.h"

@implementation SubscriptionArray
@synthesize title,source,htmlUrl;

-(void)dealloc{
    [title release];
    [source release];
    [htmlUrl release];
}

@end
Run Code Online (Sandbox Code Playgroud)

当我在这个例子中使用类时,我得到一个EXEC_BAD_ACCESS错误:

  for (NSDictionary *element in subs){
            SubscriptionArray *add;
            add.title=[element objectForKey:@"title"];   //ERROR Happens at this line
            add.source=[element objectForKey:@"htmlUrl"];
            add.htmlUrl=[element objectForKey:@"id"];
            [subscriptions addObject:add];


        }
Run Code Online (Sandbox Code Playgroud)

有人能帮我吗?PS订阅是NSMutableArray

iphone implementation class objective-c

0
推荐指数
1
解决办法
64
查看次数