Mac Meng's Blog


  • Home

  • Categories

  • Archives

  • Tags

Delegate passvalue in iOS

Posted on 2012-11-11   |  

#delegate 传值实例

实现一个delegate

@PassValueDelegate

#import <Foundation/Foundation.h>

@protocol PassValueDelegate <NSObject>

@optional
-(void)passStringValue:(NSString *)value andIndex:(NSUInteger )index;
-(void)passNSDateValue:(NSDate *)value andIndex:(NSUInteger)index;

@end

###@ ProfileMeController

谁需要实现delegate的方法 就在interface的时候写上

@interface ProfileMeController : UIViewController<PassValueDelegate>{}

然后在implation 中写具体实现
在初始化EditViewController的时候 需要

####controller.delegate = self;

-(void)passStringValue:(NSString *)value andIndex:(NSUInteger )index;
{
       NSLog(@"*** %@ %d ***",value,index);
   }
这里的delegate实现是为了 从 EditViewController 向 ProfileMeController 传递值,编辑完信息然后传回来

###@ EditViewController

interface的时候不用写delegate 但是 要声明一个变量

@interface EditViewController : UIViewController{}

@property(nonatomic,assign) NSObject<PassValueDelegate> *delegate;

然后在需要的地方传值

[self.delegate passStringValue:self.valueTextField.text andIndex:self.valueIndex];
另外不要忘记在 edit和profile 这两个文件的头部引用 PassValueDelegate.h

iOS 多人共用证书-单一开发者模式

Posted on 2012-10-06   |  

####几点纪录的

##私钥导出[多人共用一个 个人帐户开发]

  1. keychain 左侧 Keys 选择导出
  2. 导出格式 *.p12 文件
  3. 然后谁开发谁就导入这个 p12 就好了

Request From

  1. Request a Certificate From a Certificate Authority
  2. 记住email 填写 appleid email
  3. save to disk

##development push

  1. Provisioning Portal Appid 下 enable Push Notification:
  2. 上传本地 Request From的证书
  3. 下载生成的证书 cer
  4. // 生成 pem 记得 生成 p12 时候记得输入密码 要不不work
    // 生成完push证书之后 要renew develop 和 distribution 证书
  5. openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
  6. // 验证 pem
  7. openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -debug -showcerts -CAfile apns-dev-cert.pem
1…34
Mac Meng

Mac Meng

32 posts
39 tags
RSS
GitHub Twitter 微博 豆瓣 知乎
© 2013 - 2020 Mac Meng
Powered by Hexo
Theme - NexT.Muse