{"id":469,"date":"2014-02-23T01:58:45","date_gmt":"2014-02-22T17:58:45","guid":{"rendered":"http:\/\/fri.sh\/?p=469"},"modified":"2014-02-23T01:58:45","modified_gmt":"2014-02-22T17:58:45","slug":"sprite-kit-playing-sound-leads-to-app-termination","status":"publish","type":"post","link":"https:\/\/fri.sh\/blog\/2014\/sprite-kit-playing-sound-leads-to-app-termination\/","title":{"rendered":"SpriteKit \u64ad\u653e\u58f0\u97f3\u5e94\u7528\u5207\u6362\u5230\u80cc\u666f\u65f6Crush\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\u597d\u50cf\u53c8\u597d\u4e00\u6bb5\u65f6\u95f4\u6ca1\u6709\u5199\u7ed3\u7ef3\u8bb0\u4e8b\u3002\u4e00\u662f\u56e0\u4e3a\u6700\u8fd1\u6ca1\u53d1\u751f\u4ec0\u4e48\u5927\u4e8b\uff0c\u7b2c\u4e8c\u4e2a\u662f\u6700\u8fd1\u7684\u65f6\u95f4\u90fd\u88ab\u5360\u6ee1\u4e86\u3002\u6625\u8282\u4e00\u56de\u6765\uff0c\u5de5\u4f5c\u65e5\u5fd9\u5f97\u8ddf\u72d7\u4f3c\u7684\uff0c\u611f\u89c9\u6bd4\u5e74\u524d\u90a3\u6bb5\u75af\u72c2\u7684\u65f6\u95f4\u66f4\u751a\u3002\u5468\u672b\u7684\u65f6\u95f4\u8ff7\u4e0a\u4e86\u5199\u4ee3\u7801\u3002<\/p>\n<p>\u8bf4\u5230\u5199\u4ee3\u7801\uff0c\u597d\u50cf\u90fd\u662f\u653e\u4e0b\u4e86\u5feb\u5341\u5e74\u7684\u7231\u597d\u4e86\u3002\u6625\u8282\u65e0\u804a\u8bfb\u4e86\u8bfbIOS\u7f16\u7a0b\u7684\u4e00\u4e9b\u4e1c\u897f\uff0c\u5f97\u76ca\u4e8e\u82f9\u679c\u5df2\u7ecf\u628a\u5f00\u53d1\u5305\u88c5\u5f97\u8db3\u591f\u7b80\u5355\uff0c\u5bf9\u4e8e\u6211\u8fd9\u79cd\u5341\u5e74\u6ca1\u5199\u8fc7\u4ee3\u7801\u7684\u4eba\u8fd8\u7b97\u53ef\u4ee5\u4e0a\u624b\u3002\u8fb9\u770b\u6625\u665a\u548c\u6625\u665a\u91cd\u64ad\u8bfb\u4e8680\u591a\u9875\u7684developer guide\uff0c\u8ddf\u8bfb\u79d1\u5e7b\u5c0f\u8bf4\u4e00\u6837\u6b22\u4e50\u3002\u56de\u6765\u624b\u75d2\u5c31\u5f00\u59cb\u5199\u70b9\u4e1c\u897f\u3002<\/p>\n<p>\u5bf9\u4e8e\u6211\u8fd9\u79cd\u521d\u5b66\u8005\u6bcf\u5199\u4e00\u884c\u4ee3\u7801\u90fd\u4f1a\u9047\u5230\u5f88\u591a\u95ee\u9898\uff0c\u5f88\u611f\u8c22\u7f51\u7edc\u4e0a\u5f88\u591a\u5927\u725b\u5206\u4eab\u7684\u4e00\u4e9b\u5b66\u4e60\u7b14\u8bb0\u3002\u6240\u4ee5\u51b3\u5b9a\u6709\u65f6\u95f4\u4e5f\u8981\u628a\u6211\u9047\u5230\u7684\u4e00\u4e9b\u7b80\u5355\u53ef\u7b11\u7684\u95ee\u9898\u603b\u7ed3\u4e00\u4e0b\u4ee5\u793a\u540e\u4eba\u3002\u5f53\u7136\uff0c\u524d\u63d0\u662f\u6709\u65f6\u95f4\u3002<\/p>\n<p>\u5468\u672b\u7167\u4f8b\u662f\u88c5\u4fee\u65e5 + \u4ee3\u7801\u65e5\u3002\u4e00\u4e2a\u607c\u4eba\u7684bug\u6298\u78e8\u4e86\u6211\u5468\u516d\u665a\u4e0a\u597d\u51e0\u4e2a\u5c0f\u65f6\u7684\u65f6\u95f4\uff0c\u597d\u5427 \u8bf4\u6b63\u4e8b\u513f\u3002<\/p>\n<p><span style=\"color: #ff0000;\">=====\u5f00\u59cb\u8bf4\u6b63\u4e8b\u513f\u7684\u5206\u5272\u7ebf======<\/span><\/p>\n<p>\u6700\u8fd1\u5728\u5199\u4e00\u4e2a\u4f7f\u7528SpriteKit\u7684IOS\u5c0f\u6e38\u620f\u8054\u7cfb\u3002\u5728\u6a21\u62df\u5668\u4e0a\u8fd0\u884c\u90fd\u6ca1\u4ec0\u4e48\u95ee\u9898\uff0c\u771f\u673a\u8c03\u8bd5\u7684\u65f6\u5019\uff0c\u6bcf\u6b21\u56de\u5230HOME\u7684\u65f6\u5019\uff0c\u5c31\u662fapplicationDidEnterBackground\u7684\u65f6\u5019\uff0c\u7a0b\u5e8f\u5c31\u4f1aCrush\u3002<\/p>\n<p>\u62a5\u7684\u9519\u8bef\u662fmain.m\u4e2d Thread1:EXC_BAD_ACCESS(code=1,address=0x1)\u3002\u7f51\u4e0a\u641c\u4e86\u4e00\u4e0b\u5927\u6982\u8fd9\u79cd\u95ee\u9898\u662fARC\u9519\u8befrelease\u7684\u5bf9\u8c61\u518d\u6b21\u88abrelease\u3002\u82b1\u4e86\u51e0\u4e2a\u5c0f\u65f6\u6328\u4e2a\u65b9\u6cd5\u6ce8\u91ca\u4ee3\u7801\uff0c\u7ec8\u4e8e\u53d1\u73b0\u5f53\u8fd0\u884cSKAction\u7684-playSoundFileNamed: waitForCompletion: \u65b9\u6cd5\u65f6\u5fc5\u51fa\u73b0\u8fd9\u4e2a\u9519\u8bef\u3002<\/p>\n<p>\u540e\u6765\u7ec8\u4e8e\u5728\u4e07\u80fd\u7684SteakOverFlow\u627e\u5230\u4e86\u9047\u5230\u540c\u6837\u95ee\u9898\u7684\u4eba\uff0c\u89e3\u51b3\u529e\u6cd5\u4e5f\u5728\u540c\u4e00\u4e2a\u5e16\u5b50\u91cc\u3002<\/p>\n<p><span style=\"color: #ff0000;\">\u7b54\u6848\u5728\u8fd9\u91cc<\/span>\uff1a<a href=\"http:\/\/stackoverflow.com\/questions\/18976813\/sprite-kit-playing-sound-leads-to-app-termination\/21349677#21349677\" target=\"_blank\" rel=\"noopener\">http:\/\/stackoverflow.com\/questions\/18976813\/sprite-kit-playing-sound-leads-to-app-termination\/21349677#21349677<\/a><\/p>\n<p>\u7b80\u5355\u7684\u8bf4\uff0c\u662f\u56e0\u4e3a-playSoundFileNamed: waitForCompletion: \u7528\u5230\u4e86AVAudioSession\u7c7b\uff0c\u5f53\u5e94\u7528\u8fdb\u5165\u80cc\u666f\u8fd0\u884c\u65f6\uff0cAVAudioSession \u5fc5\u987b\u662f\u975e\u6fc0\u6d3b\u7684\uff0c\u5426\u5219\u5c31\u4f1a\u62a5\u9519\u3002\u7136\u800cSpriteKit\u5728\u64ad\u653e\u58f0\u97f3\u662f\u5e76\u6ca1\u6709\u5bf9\u5176\u8fdb\u884c\u5904\u7406\u3002\u89e3\u51b3\u529e\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u5c31\u662f\u5728\u5e94\u7528\u80cc\u666f\u8fd0\u884c\u65f6\u5c06AVAudioSession\u8bbe\u7f6e\u4e3ainActive\uff0c\u5e94\u7528\u56de\u5230\u524d\u666f\u65f6\uff0c\u91cd\u65b0\u8bbe\u7f6e\u4e3aActive\u3002<\/p>\n<p>\u5177\u4f53\u7684\u5904\u7406\u65b9\u5f0f\u8fd9\u91cc\u5c31\u4e0d\u5f53\u642c\u8fd0\u5de5\u4e86\uff0c\u5927\u5bb6\u53bb\u770b\u8ba8\u8bba<a href=\"http:\/\/stackoverflow.com\/questions\/18976813\/sprite-kit-playing-sound-leads-to-app-termination\/21349677#21349677\" target=\"_blank\" rel=\"noopener\">\u539f\u6587<\/a>\u5427\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u50cf\u53c8\u597d\u4e00\u6bb5\u65f6\u95f4\u6ca1\u6709\u5199\u7ed3\u7ef3\u8bb0\u4e8b\u3002\u4e00\u662f\u56e0\u4e3a\u6700\u8fd1\u6ca1\u53d1\u751f\u4ec0\u4e48\u5927\u4e8b\uff0c\u7b2c\u4e8c\u4e2a\u662f\u6700\u8fd1\u7684\u65f6\u95f4\u90fd\u88ab\u5360\u6ee1\u4e86\u3002\u6625\u8282\u4e00\u56de\u6765\uff0c\u5de5\u4f5c\u65e5\u5fd9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[2,1],"tags":[29,31,46,60,62,159],"class_list":["post-469","post","type-post","status-publish","format-standard","hentry","category--coding","category-uncategorized","tag-cocoa","tag-exc_bad_access","tag-ios-7","tag-playsoundfilenamed","tag-spritekit","tag-159"],"_links":{"self":[{"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/posts\/469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":0,"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"wp:attachment":[{"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fri.sh\/blog\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}