小编NTT*_*ake的帖子

找到可用的Wi-Fi网络

如何找到并列出范围内的所有Wi-Fi网络?

iphone objective-c wifi ipad ios

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

将数据从iOS发送到Java套接字服务器

嗨,我有下一个问题,为什么当我发送这样的数据

uint8_t buffer[11] = "I send this";

NSInteger nwritten = [outputStream write:buffer maxLength:sizeof(buffer)];

if (-1 == nwritten) {
    NSLog(@"Error writing to stream %@: %@", outputStream, [outputStream streamError]);
}else{
    NSLog(@"Wrote %i bytes to stream %@.", nwritten, outputStream);
}
Run Code Online (Sandbox Code Playgroud)

在java套接字服务器的另一端

connection = new Socket(Constants.HOST, Constants.CHAT_LISTENER_PORT);
_in = new DataInputStream(connection.getInputStream());
String data = _in.readUTF();
Run Code Online (Sandbox Code Playgroud)

但没有任何东西看起来好像没有发送任何东西.

我读了很多,我发现问题来自平台,因为java字节适用于big-endians和带小端的iOS,但我没有找到有关如何做到这一点的信息.

uint8_t buffer [11] ="我发送此信息"; 到big-Endians格式

请heellppp,谢谢.

对不起,我的英语非常好,但西班牙语中没有任何内容:/ thaks.

java objective-c

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

应用程序在dealloc崩溃

我的应用程序崩溃了dealloc,但有时只会崩溃.

我创建了一个用于缓存5个对象的数组.当用户点击左右对象时,会添加一个新对象,并删除最后一个对象.当我测试应用程序时,在点击右键或左键100-500次后,应用程序崩溃了.

应用程序在dealloc方法中崩溃,但所有对象都已正确分配和释放.

我的dealloc方法:

 - (void)dealloc
{
    [super dealloc];
    [_sImageLane release];
    [_sTipoLane release];
    [_maRecomended release];
    [_maProdcucts release]; // here crash in this line EXC_BAD_ACCESSE
}
Run Code Online (Sandbox Code Playgroud)

出了什么问题?

memory iphone objective-c ipad ios

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

@property中的记忆腐败

我有下一段代码,一个iVar保留了这个属性,并在它的类dealloc方法中发布.iVar用于2种方法并不断更改值,但有时当我使用该值时已损坏.这是为什么?

.H

@interface ChatController : NSObject <ASIHTTPRequestDelegate>{
NSTimer *timer;
NSString *_idLastMessageFromServer;
}

@property(nonatomic, retain)NSString *idLastMessageFromServer;
@end
Run Code Online (Sandbox Code Playgroud)

.M

@implementation ChatController

@synthesize idLastMessageFromServer = _idLastMessageFromServer;

- (void)initLoopTimer{
timer = [NSTimer timerWithTimeInterval:5 target:self selector:@selector(update:) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
}

- (void)update:(id)sender{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:CONSTANT_YYYY];
[request setDelegate:self];
[request addPostValue:_idLastMessageFromServer forKey:CONSTANT_XXX];
[request setDidFinishSelector:@selector(requestUpdateFinish:)];
[request startAsynchronous];
}

- (void)requestUpdateFinish:(ASIHTTPRequest *)request{
NSString *response = [request responseString];
if(response && response.length){
    if(![response isEqualToString:CHAT_RESPONSE_NO_MESSAGES]){
        NSArray *array = [response componentsSeparatedByString:CHAT_PARSE_RESPONSE];
        if(array && [array count] == …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ipad ios

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

标签 统计

objective-c ×4

ios ×3

ipad ×3

iphone ×3

java ×1

memory ×1

wifi ×1