gpt4 book ai didi

iphone - RackSpace身份验证

转载 作者:行者123 更新时间:2023-12-01 19:15:30 25 4
gpt4 key购买 nike

我正在尝试使用RackSpace API进行身份验证以使用ASIHttp库获取Auth-Token
但是我的问题是有时它可以正常工作,但是大多数时候我都遇到了崩溃

libobjc.A.dylib`objc_release:
0x16cd090: pushl %ebp
0x16cd091: movl %esp, %ebp
0x16cd093: subl $8, %esp
0x16cd096: calll 0x16cd09b ; objc_release + 11
0x16cd09b: popl %ecx
0x16cd09c: movl 8(%ebp), %eax
0x16cd09f: testl %eax, %eax
0x16cd0a1: je 0x16cd0d5 ; objc_release + 69
0x16cd0a3: movl (%eax), %edx
0x16cd0a5: movl 16(%edx), %edx
0x16cd0a8: andl $-4, %edx
0x16cd0ab: testb $2, 2(%edx)
0x16cd0af: je 0x16cd0c5 ; objc_release + 53
0x16cd0b1: movl 1002149(%ecx), %ecx
0x16cd0b7: movl %ecx, 4(%esp)
0x16cd0bb: movl %eax, (%esp)
0x16cd0be: calll 0x16cc08c ; objc_msgSend
0x16cd0c3: jmp 0x16cd0d5 ; objc_release + 69
0x16cd0c5: movl %eax, (%esp)
0x16cd0c8: movl $0, 4(%esp)
0x16cd0d0: calll 0x16ce9d0 ; -[NSObject release]
0x16cd0d5: addl $8, %esp
0x16cd0d8: popl %ebp
0x16cd0d9: ret

我无法理解实际出了什么问题。请帮助我解决此问题。

编辑:

这是我正在使用的代码
+ (void)authenticate
{
[accessDetailsLock lock];
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:RACSPACE_AUTHENTICATE_API]];
[request addRequestHeader:@"Content-type" value:@"application/json"];

NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setObject:RACSPACE_USER_NAME forKey:@"username"];
[dic setObject:RACSPACE_PASSWORD forKey:@"apiKey"];

NSMutableDictionary *dic1 = [[NSMutableDictionary alloc] init];
[dic1 setObject:dic forKey:@"RAX-KSKEY:apiKeyCredentials"];

NSMutableDictionary *finalDic = [[NSMutableDictionary alloc] init];
[finalDic setObject:dic1 forKey:@"auth"];

SBJSON *sbJson= [[SBJSON alloc] init];
NSString *strJson =[sbJson stringWithObject:finalDic];
NSLog(@"%@",strJson);
[request setPostBody:(NSMutableData*)[strJson dataUsingEncoding:NSUTF8StringEncoding]];

[strJson release];
[dic release];
[dic1 release];
[finalDic release];
[request startSynchronous];

if (![request error])
{
NSDictionary *responseHeaders = [request responseHeaders];
NSLog(@"Response%@",[responseHeaders description]);
NSLog(@"Response 2=%@",[request responseString]);
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *jsonObject = [[parser objectWithString:[request responseString]] objectForKey:@"access"];
[parser release];

authToken = [[jsonObject objectForKey:@"token"] objectForKey:@"id"];

NSArray *services = [jsonObject objectForKey:@"serviceCatalog"];

for (NSDictionary *service in services)
{
if ([[service valueForKey:@"type"] isEqualToString:@"object-store"])
{
if ([[service valueForKey:@"name"] isEqualToString:@"cloudFiles"])
{

NSDictionary *endpoint = [[service valueForKey:@"endpoints"] objectAtIndex:0];
storageURL = [NSURL URLWithString:[endpoint valueForKey:@"publicURL"]];

}
}
else if([[service valueForKey:@"type"] isEqualToString:@"rax:object-cdn"])
{
if ([[service valueForKey:@"name"] isEqualToString:@"cloudFilesCDN"])
{
NSDictionary *endpoint = [[service valueForKey:@"endpoints"] objectAtIndex:0];
cdnManagementURL = [NSURL URLWithString:[endpoint valueForKey:@"publicURL"]];

}
}
}
[request release];
[accessDetailsLock unlock];
}

}

最佳答案

据我所知,看起来您正在释放一个已经在自动释放池中的对象。

看一下这一行:

NSString *strJson = [sbJson stringWithObject:finalDic];

SBJson source中,我可以看到它返回了自动释放的NSString。然后,您在此行下面释放:
[strJson release];

这导致了EXC_BAD_ACCESS。

我在Rackspace的Mobile团队工作,所以请告诉我是否对您有帮助,或者我可以通过其他任何方式提供帮助。

关于iphone - RackSpace身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13700336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com