小编Joj*_*dmo的帖子

可以重用Objective-c指针吗?

在一个简单的基于视图的项目中,我appDelegate使用以下代码在我的文件中添加了一个变量:

NSObject* gObj;

@property(noatomic,retain) NSObject* gObj;

@synthesize gObj;
Run Code Online (Sandbox Code Playgroud)

然后,在我的testviewController.mviewDidLoad方法中,我添加了以下测试代码:

testAppDelegate* delegate = [[UIApplication sharedApplication] delegate];

NSObject* p1 = [NSObject alloc] init];//the reference count is 1
delegate.gObj = p1;//the reference count of p1 is 2

[p1 release];//the ref of p1 is 1 again 
[delegate.gObj release];//the ref of p1 is 0 

NSObject* p2 = [NSObject alloc] init]; // a new object
delegate.gObj = p2;//this time the program crash,   why? should not the pointer be supposed to be re-used …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

防止攻击者反编译iOS应用并获取数据库访问权限

根据这篇文章,可以反编译一个iOS应用程序。

如何防止攻击者访问我的AWS DynamoDB数据库?像Amazon开发人员指南中所示的那样将访问密钥公开开放似乎并不十分安全。

我认为我可以使用钥匙串来存储密钥,但是对于有动机的攻击者,如果他们拥有应用程序的汇编源代码,我觉得这将是一种简便的方法。

目前,我使用Amazon Cognito进行连接。我需要使用的只是身份ID和角色名称。我看不出有什么能阻止攻击者简单地获取这些值并连接到数据库。

例如,什么阻止了攻击者反编译Facebook iOS应用程序代码并删除所有用户?

如何防止攻击者反编译我的iOS应用程序并获得对数据库访问密钥的访问权,或者至少阻止他们造成任何重大损害(例如删除用户)?

security decompiling ios swift

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

为iPhone 4和iPhone 5使用两个不同的nib文件

有没有办法检测用户使用的设备,然后使用该信息,使应用程序使用特定的nib文件?

现在,我的代码是

- (BOOL)application: (UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions{
  if(isiPhone5){
    self.RootViewController = @"RootViewController_iPhone5";
  }
  else{
    self.RootViewController = @"RootViewController_iPhone4";
  }
}
Run Code Online (Sandbox Code Playgroud)

我找到设备的其他代码可以工作并告诉我用户正在使用什么设备,但实际上并没有将.xib文件更改RootViewController_iPhone4.xibRootViewController_iPhone5.xib.有没有办法做到这一点?

我不想使用自动布局,因为我想根据设备发生其他自定义事件,例如视图控制器中的不同按钮名称,如果使用的设备是iPhone 4和iPhone 5

objective-c xib nib

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

如何在java中匹配正则表达式

我想要一个这样的模式:GJ-16-RS-1234我已经应用了以下模式,但它们不起作用.

我的正则表达式是:

String str_tempPattern = "(^[A-Z]{2})\\-([0-9]{2})\\-([A-Z]{1,2})\\-([0-9]{1,4}$)";

String str_tempPattern = "(^[A-Z]{2})-([0-9]{1,2})-([A-Z]{1,2})-([0-9]{1,4})$";

String str_tempPattern = "^[A-Z]{2}\\-[0-9]{1,2}\\-[A-Z]{1,2}\\-[0-9]{1,4}$";
Run Code Online (Sandbox Code Playgroud)

我正在使用文本观察器检查是否有任何变化 aftertextchange()

Pattern p = Pattern.compile(str_tempPattern, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    Matcher m = p.matcher(s);

    if (m.find()){

    }
Run Code Online (Sandbox Code Playgroud)

java regex android textwatcher

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

将世界边界设置为 400 个方块

我想在服务器启动时将世界边界设置为400个方块,这样玩家就不能离开地图太远。

我怎样才能做到这一点?我自己找不到任何方法。

java minecraft bukkit

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

标签 统计

ios ×2

java ×2

objective-c ×2

android ×1

bukkit ×1

decompiling ×1

iphone ×1

minecraft ×1

nib ×1

regex ×1

security ×1

swift ×1

textwatcher ×1

xib ×1