近期对自己的App进行上架,其中走了很多弯路,最后终于成功了!总结了下方便以后复习同时让大家看下有没有纰漏的地方。
一、真机调试介绍
QQ20161031-0.png
二、怎样做真机调试
QQ20161031-1.png三、申请AppleID在这里就不做说明了,直接进这里https://appleid.apple.com/cn/注册就可以了
四、申请好AppleID后需要加入苹果开发者计划
QQ20161031-2.png QQ20161031-3.png QQ20161031-4.png QQ20161031-5.png QQ20161101-0.png QQ20161101-1.png QQ20161101-2.png QQ20161101-3.png QQ20161101-4.png QQ20161101-5.png五、配置真机调试
开发者主页:https://developer.apple.com
QQ20161101-0.png QQ20161101-1.png QQ20161101-2.png QQ20161101-3.png QQ20161101-4.png QQ20161101-5.png![QQ20161101-6.png](http:https://img.haomeiwen.com/i1825653/44e06bcf38232990.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
![QQ20161101-7.png](http:https://img.haomeiwen.com/i1825653/ba76df5f26421cb9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
![QQ20161101-8.png](http:https://img.haomeiwen.com/i1825653/8640e269c94d8b21.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
![QQ20161101-9.png](http:https://img.haomeiwen.com/i1825653/d4156f5f0c99018e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
QQ20161101-10.png QQ20161101-11.png![QQ20161101-12.png](http:https://img.haomeiwen.com/i1825653/b65189eec4336eb0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
QQ20161101-13.png QQ20161101-14.png QQ20161101-15.png QQ20161101-16.png QQ20161101-17.png QQ20161101-18.png QQ20161101-19.png QQ20161101-20.png![QQ20161101-21.png](http:https://img.haomeiwen.com/i1825653/853b1650aa70744e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
QQ20161101-22.png![QQ20161101-23.png](http:https://img.haomeiwen.com/i1825653/ba29484e85020566.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
QQ20161101-24.png六、配置P12文件
QQ20161101-0.png QQ20161101-1.png QQ20161101-2.png七、测试打包介绍和流程
QQ20161101-3.png QQ20161101-0.png QQ20161101-1.png QQ20161101-2.png QQ20161101-3.png QQ20161101-4.png QQ20161101-5.png QQ20161101-6.png QQ20161101-7.png QQ20161101-8.png八、发布应用程序
QQ20161101-0.png QQ20161101-1.png![QQ20161101-2.png](http:https://img.haomeiwen.com/i1825653/245fe22ec650770d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240
QQ20161101-3.png QQ20161101-4.png QQ20161101-5.png QQ20161101-6.png QQ20161101-7.png QQ20161101-8.png QQ20161101-9.png QQ20161101-10.png QQ20161101-11.png QQ20161101-12.png QQ20161101-13.png QQ20161101-14.png QQ20161101-15.png QQ20161101-16.png九、APP内购的介绍
QQ20161101-0.png QQ20161101-1.png QQ20161101-2.png QQ20161101-3.png QQ20161101-4.png QQ20161101-5.png QQ20161101-6.png QQ20161101-7.png QQ20161101-8.png QQ20161101-9.png QQ20161101-10.png QQ20161101-11.png- (void)requestWangtedProducts
{
// 1.获取想要卖的商品的ProductId
NSString *productPath = [[NSBundle mainBundle] pathForResource:@"iapdemo.plist" ofType:nil];
NSArray *products = [NSArray arrayWithContentsOfFile:productPath];
NSArray *productIds = [products valueForKeyPath:@"productId"];
// 2.将ProductIds发送到苹果服务器,请求这些商品是否可卖
NSSet *productIdSet = [NSSet setWithArray:productIds];
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdSet];
request.delegate = self;
[request start];
}
在代理方法中拿到可销售的商品
pragma mark - 实现SKProductsRequest的代理方法
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
// 1.获取可销售的商品,并且排序
self.products = [response.products sortedArrayWithOptions:NSSortConcurrent usingComparator:^NSComparisonResult(SKProduct *obj1, SKProduct *obj2) {
return [obj1.price compare:obj2.price];
}];
// 2.以tableView的形式展示商品
[self.tableView reloadData];
}
用户点击购买,创建票据
- (void)buyProduct:(SKProduct *)product
{
// 1.创建票据
SKPayment *payment = [SKPayment paymentWithProduct:product];
// 2.将票据加到到交易队列中
[[SKPaymentQueue defaultQueue] addPayment:payment];
// 3.观察交易队列中交易发生的改变
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
}
交易队列中交易发生改变时,执行的监听方法
pragma mark - 实现交易发生改变的回调方法
-
(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
NSLog(@"正在购买商品");
break;case SKPaymentTransactionStatePurchased: NSLog(@"购买成功"); [queue finishTransaction:transaction]; break; case SKPaymentTransactionStateFailed: NSLog(@"购买商品失败"); [queue finishTransaction:transaction]; break; case SKPaymentTransactionStateRestored: NSLog(@"恢复购买"); [queue finishTransaction:transaction]; break; case SKPaymentTransactionStateDeferred: NSLog(@"最终状态未决定"); break; default: break;
}
}
以上供大家参考!谢谢!
网友评论